/*
 * Gestaltungs-Grundeinstellungen (Design-Tokens)
 * ------------------------------------------------
 * Alle Farben der Anwendung werden über diese Variablen gesteuert.
 * Für das Erscheinungsbild "Ränder dunkler grau als die Mitte" sind vor
 * allem --bg-page (Fläche links/rechts neben dem Inhalt) und
 * --bg-content (Fläche des Inhaltsbereichs selbst) relevant. Die
 * --topbar-* Variablen steuern die dunkle Kopfleiste (an die Optik der
 * Pflegeheimverwaltung angelehnt). Einfach hier die Werte anpassen, der
 * Rest der Datei muss nicht angefasst werden.
 */
:root {
    --border: #d5d9df;
    --bg-page: #c9ccd2;     /* Rand links/rechts – deutlich grau */
    --bg-content: #eceef1;  /* Fläche hinter dem eigentlichen Inhalt – hell */
    --text: #3f454d;
    --muted: #646a73;
    --accent: #2c69a6;
    --accent-dark: #1c4d80;
    --danger: #b3261e;
    --ok-bg: #e6f4ea;
    --ok-text: #1e6b34;
    --err-bg: #fdecea;
    --err-text: #a12a20;

    /* Kopfleiste – bewusst dunkel, wie in der Pflegeheimverwaltung */
    --topbar-bg: #23262b;
    --topbar-text: #e6e8eb;
    --topbar-muted: #9ba0a8;
    --topbar-hover-bg: #2f343b;

    /* Eckenrundung – einheitlich über die ganze Anwendung gesteuert */
    --radius: 10px;      /* Buttons, Eingabefelder, Tabellen, Hinweise */
    --radius-lg: 14px;    /* Karten/Formulare, Detail-Boxen */
    --radius-pill: 999px; /* Navigation, Badges */
}

* { box-sizing: border-box; }

html {
    background: var(--bg-page);
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-page);
    color: var(--text);
}

.topbar {
    background: var(--topbar-bg);
}

.topbar-inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--topbar-text);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.brand-logo {
    max-height: 40px;
    max-width: 200px;
    display: block;
}

nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

nav a {
    padding: 8px 14px;
    border-radius: var(--radius-pill);
    color: var(--topbar-muted);
    text-decoration: none;
    font-size: 0.92rem;
    transition: background-color .15s, color .15s;
}

nav a:hover { background: var(--topbar-hover-bg); color: var(--topbar-text); }

nav a.active {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

.user-badge {
    font-size: 0.85rem;
    color: var(--topbar-muted);
    white-space: nowrap;
}
.user-badge a { color: var(--topbar-text); text-decoration: none; }
.user-badge a:hover { text-decoration: underline; }

.content {
    max-width: 1000px;
    margin: 0 auto;
    padding: 24px 20px 60px;
    background: var(--bg-content);
    min-height: calc(100vh - 70px);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.03);
}

h1 { font-size: 1.5rem; margin-bottom: 18px; }
h2 { font-size: 1.15rem; margin: 24px 0 10px; }

.flash {
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 18px;
    font-size: 0.95rem;
}
.flash-success { background: var(--ok-bg); color: var(--ok-text); }
.flash-error { background: var(--err-bg); color: var(--err-text); }

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

th, td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-size: 0.92rem;
}

th { background: #eef1f5; font-weight: 600; }
tr:last-child td { border-bottom: none; }

.text-right { text-align: right; }
.muted { color: var(--muted); }

.btn {
    display: inline-block;
    padding: 8px 14px;
    border-radius: var(--radius);
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    border: none;
    font-size: 0.92rem;
    cursor: pointer;
}
.btn:hover { background: var(--accent-dark); }
.btn-secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #f0f2f5; }
.btn-danger { background: #fff; color: var(--danger); border: 1px solid var(--danger); }
.btn-danger:hover { background: var(--err-bg); }
.btn-small { padding: 5px 10px; font-size: 0.85rem; }

form.card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    max-width: 720px;
}

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

.field { margin-bottom: 14px; }
.field label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #33404f;
}
.field .hint { font-size: 0.8rem; color: var(--muted); margin-top: 3px; }

input[type=text], input[type=email], input[type=number], input[type=date],
select, textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.92rem;
    font-family: inherit;
    background: #fff;
    color: var(--text);
}
textarea { resize: vertical; }

.items-table th, .items-table td { padding: 6px 8px; }
.items-table input, .items-table select { padding: 6px 8px; }
.col-service { width: 20%; }
.col-desc { width: 24%; }
.col-qty { width: 10%; }
.col-unit { width: 12%; }
.col-price { width: 14%; }
.col-vat { width: 10%; }
.col-remove { width: 6%; text-align: center; }

.actions-row { margin-top: 16px; display: flex; gap: 10px; }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    background: #eef1f5;
    color: #33404f;
}
.badge-zugferd { background: #e3edfb; color: #1c4a91; }
.badge-xrechnung { background: #fdf1de; color: #8a5a0c; }
.badge-inactive { background: #f1e4e4; color: #8a2c2c; margin-left: 8px; vertical-align: middle; }
.badge-credit { background: #fdf1de; color: #8a5a0c; margin-left: 6px; }

/* Buchstaben-Trenner in Kunden-/Lieferantenlisten */
.letter-row td {
    background: #e4e7ec;
    color: var(--accent-dark);
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 6px 12px;
    border-top: 2px solid var(--border);
}
.letter-row:first-child td { border-top: none; }

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #33404f;
    cursor: pointer;
}
.checkbox-label input[type=checkbox] {
    width: auto;
    margin: 0;
}

/* Monats-/Jahresnavigation auf der Startseite */
.month-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.month-nav select { width: auto; padding: 6px 8px; }

/* A-Z-Sprungleiste in Kunden-/Lieferantenlisten: alle Buchstaben als
   gleichgroße Buttons (nutzt die vorhandenen .btn-Klassen der Anwendung) */
.az-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}
.az-nav .az-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    text-align: center;
    line-height: 30px;
    border-radius: 50%;
}
.az-btn.az-btn-disabled {
    color: #c3c8d1;
    background: #f5f6f8;
    border-color: var(--border);
    cursor: default;
}

.download-links a { margin-right: 10px; }

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 20px;
}
.detail-box {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
}
.detail-box h3 { margin: 0 0 8px; font-size: 0.95rem; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; }

@media (max-width: 640px) {
    .grid-2, .detail-grid { grid-template-columns: 1fr; }
}
