/* ZHD STAMMDATEN — lokale Styles, KEINE externen Fonts/CDN. */
:root {
    --accent: #1c5fc4;
    --accent-dark: #154a9c;
    --bg: #f6f8fb;
    --card: #ffffff;
    --border: #dee2e6;
    --text: #1a1a2e;
    --muted: #6c757d;
    --danger: #842029;
    --danger-bg: #f8d7da;
    --ok: #0f5132;
    --ok-bg: #d1e7dd;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

/* ── Auth-Screen ──────────────────────────────────────────────────────── */
body.auth {
    background: linear-gradient(135deg, #4a8fd9 0%, var(--accent) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.login-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.25);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}
.brand { text-align: center; margin-bottom: 28px; }
.brand .logo {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    padding: 10px 22px;
    border-radius: 8px;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 3px;
    margin-bottom: 14px;
}
.brand h1 { font-size: 18px; margin: 0; }
.brand p { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.form-group { margin-bottom: 16px; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
input[type="text"], input[type="password"], input[type="number"], textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; }
.error {
    background: var(--danger-bg);
    color: var(--danger);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 16px;
}
.version {
    text-align: center;
    font-size: 11px;
    color: #adb5bd;
    margin-top: 24px;
}

/* ── App-Chrome ───────────────────────────────────────────────────────── */
.topbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.brand-row { display: flex; align-items: center; gap: 12px; }
.logo-sm {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 2px;
}
.muted { color: var(--muted); }

.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 24px 20px 64px;
}
.container h1 { margin-top: 0; }

.flash {
    padding: 12px 16px;
    border-radius: 8px;
    margin: 12px 0 20px;
    font-size: 14px;
}
.flash.ok  { background: var(--ok-bg); color: var(--ok); }
.flash.err { background: var(--danger-bg); color: var(--danger); }
.hidden { display: none; }

/* ── Settings-Cards ───────────────────────────────────────────────────── */
.settings-list {
    display: grid;
    gap: 16px;
}
.setting-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.setting-head {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
}
.setting-head h2 {
    font-size: 16px;
    margin: 0;
    font-weight: 600;
}
.setting-head code {
    background: #eef3f9;
    color: var(--accent-dark);
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 14px;
}
.badge {
    background: #eef3f9;
    color: var(--accent-dark);
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
}
.desc {
    margin: 8px 0 12px;
    color: var(--muted);
    font-size: 13px;
}
.setting-body { margin: 8px 0 12px; }
.setting-body .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.setting-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-top: 1px solid var(--border);
    padding-top: 10px;
    margin-top: 8px;
}
.meta { font-size: 12px; color: var(--muted); }

.switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}
.switch input { width: 18px; height: 18px; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 9px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { background: transparent; color: var(--accent); border: 1px solid var(--border); }
.btn-ghost:hover { background: #eef3f9; }
.btn-block { width: 100%; padding: 12px; }

/* ── Modal ─────────────────────────────────────────────────────────────── */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 100;
}
.modal-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    max-width: 560px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
.modal-card h2 { margin-top: 0; }
.modal-card pre {
    background: #f6f8fb;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 13px;
    max-height: 200px;
    overflow-y: auto;
}
.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 16px;
}

/* ── Nav-Links in Topbar ─────────────────────────────────────────────────── */
.nav-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.nav-links .btn { padding: 6px 12px; font-size: 13px; }

/* ── Toolbar (Suche, Neu-Button) ─────────────────────────────────────────── */
.toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 12px 0 20px;
    flex-wrap: wrap;
}
.toolbar-spacer { flex: 1; }
.search-input {
    flex: 1;
    min-width: 200px;
    max-width: 400px;
    padding: 9px 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    color: var(--text);
}
.search-input:focus { outline: none; border-color: var(--accent); }

/* ── Entity-Cards (Kunden / Maschinen / Mitarbeiter) ─────────────────────── */
.entity-list {
    display: grid;
    gap: 16px;
}
.entity-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.entity-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}
.entity-head h2 {
    font-size: 16px;
    margin: 0;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.entity-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px 16px;
    margin: 12px 0;
}
.field-row label {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.field-row .field-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.field-row .field-input {
    padding: 8px 10px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    width: 100%;
}
.field-row .field-input:focus { outline: none; border-color: var(--accent); }
.field-row textarea.field-input { resize: vertical; min-height: 60px; }
.field-row input[type="checkbox"].field-input {
    width: 20px;
    height: 20px;
    align-self: flex-start;
}

.entity-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    border-top: 1px solid var(--border);
    padding-top: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}
.entity-foot .actions {
    display: flex;
    gap: 8px;
}

.badge-ok {
    background: var(--ok-bg);
    color: var(--ok);
}
.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
}
