:root {
    --blau: #1C5195;
    --blau-d: #163f74;
    --gruen: #089E5E;
    --rot: #DB1B38;
    --bg: #f4f6f9;
    --card: #ffffff;
    --line: #e2e6ec;
    --text: #1f2733;
    --muted: #7a8598;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
}
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
a { color: var(--blau); }

/* Topbar */
.topbar {
    background: var(--blau);
    color: #fff;
    box-shadow: 0 1px 0 rgba(0,0,0,.08);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.brand { color: #fff; text-decoration: none; display: flex; align-items: center; gap: 10px; font-size: 16px; }
.brand b { font-weight: 700; }
.brand-mark {
    width: 16px; height: 22px; border-radius: 2px;
    background: linear-gradient(180deg, var(--rot) 0 33%, var(--blau-d) 33% 66%, var(--gruen) 66% 100%);
    box-shadow: inset 0 0 0 2px rgba(255,255,255,.5);
}
.topnav { display: flex; gap: 4px; align-items: center; }
.topnav a { color: #dbe6f5; text-decoration: none; padding: 8px 12px; border-radius: 6px; font-size: 14px; }
.topnav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.topnav a.logout { color: #ffd7dc; }

main.wrap { padding-top: 26px; padding-bottom: 40px; }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
h1 { font-size: 24px; margin: 0; }
h2 { font-size: 17px; margin: 0; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: #fff; color: var(--text);
    border: 1px solid var(--line); border-radius: 8px;
    padding: 8px 14px; font-size: 14px; cursor: pointer;
    text-decoration: none; line-height: 1;
    transition: background .12s, border-color .12s;
}
.btn:hover { background: #f0f3f8; }
.btn-primary { background: var(--blau); border-color: var(--blau); color: #fff; }
.btn-primary:hover { background: var(--blau-d); }
.btn-accent { background: var(--gruen); border-color: var(--gruen); color: #fff; }
.btn-accent:hover { filter: brightness(.94); }
.btn-danger { background: #fff; border-color: #f0c2c8; color: var(--rot); }
.btn-danger:hover { background: #fdeef0; }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 6px; }
.btn-block { width: 100%; justify-content: center; margin-top: 8px; }
form.inline { display: inline; }

/* Cards */
.card {
    background: var(--card); border: 1px solid var(--line);
    border-radius: 12px; padding: 18px; margin-bottom: 18px;
}
.card-narrow { max-width: 460px; }
.card-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }

/* Flash */
.flash { padding: 11px 14px; border-radius: 9px; margin-bottom: 16px; font-size: 14px; }
.flash-ok { background: #e5f5ec; color: #0c6b41; border: 1px solid #b7e2ca; }
.flash-err { background: #fdecef; color: #a11226; border: 1px solid #f3c3cc; }

/* Archiv-Tabelle */
table.archiv { width: 100%; border-collapse: collapse; background: #fff;
    border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
table.archiv th, table.archiv td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); }
table.archiv thead th { background: #f7f9fc; font-size: 13px; color: var(--muted); font-weight: 600; }
table.archiv tbody tr:last-child td { border-bottom: none; }
table.archiv .num { text-align: center; width: 90px; }
table.archiv .titelcell a { font-weight: 600; text-decoration: none; }
table.archiv .actions { text-align: right; white-space: nowrap; }
table.archiv .actions .btn { margin-left: 4px; }
.muted { color: var(--muted); }

.empty { text-align: center; padding: 60px 20px; background: #fff; border: 1px dashed var(--line); border-radius: 12px; }
.empty p { color: var(--muted); margin-bottom: 16px; }

/* Login */
.loginbox { max-width: 360px; margin: 60px auto; background: #fff; border: 1px solid var(--line);
    border-radius: 14px; padding: 30px; }
.loginbox h1 { margin-bottom: 4px; }

/* Formulare */
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], select {
    width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
    font-size: 14px; margin-top: 4px; background: #fff; color: var(--text);
}
input:focus, select:focus { outline: none; border-color: var(--blau); box-shadow: 0 0 0 3px rgba(28,81,149,.14); }

.grid-kopf { display: grid; grid-template-columns: 200px 140px 1fr; gap: 16px; align-items: end; }
.titel-vorschau { font-size: 14px; color: var(--muted); padding-bottom: 10px; }
.titel-vorschau b { color: var(--text); }

/* Editor-Tabelle */
table.editor { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
table.editor th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 4px 6px; }
table.editor td { padding: 3px 6px; vertical-align: middle; }
table.editor input { margin-top: 0; }
.h-grip, .c-grip { width: 26px; }
.h-datum { width: 140px; }
.h-uhrzeit { width: 120px; }
.h-tp { width: 64px; }
.h-einheiten { width: 150px; }
.h-verantw { width: 180px; }
.h-del, .c-del { width: 34px; }
input.tp { text-align: center; }
.grip { cursor: grab; color: #b7c0cd; user-select: none; font-size: 15px; padding: 0 2px; }
.grip:active { cursor: grabbing; }
.erow.dragging { opacity: .5; background: #eef3fb; }
.rowdel { background: #fff; border: 1px solid var(--line); color: var(--muted); border-radius: 6px;
    width: 28px; height: 30px; cursor: pointer; font-size: 13px; }
.rowdel:hover { color: var(--rot); border-color: #f0c2c8; background: #fdeef0; }

.formactions { display: flex; gap: 10px; align-items: center; margin-top: 4px; }

.pagefoot { color: var(--muted); font-size: 13px; text-align: center; padding: 24px 0 34px; }

@media (max-width: 780px) {
    .grid-kopf { grid-template-columns: 1fr 1fr; }
    .titel-vorschau { grid-column: 1 / -1; }
    table.editor, table.editor thead, table.editor tbody, table.editor th, table.editor td, table.editor tr { display: block; }
    table.editor thead { display: none; }
    .erow { border: 1px solid var(--line); border-radius: 10px; padding: 8px; margin-bottom: 12px; background: #fff; }
    .c-grip, .c-del { display: inline-block; }
    table.archiv, table.archiv thead, table.archiv tbody, table.archiv th, table.archiv td, table.archiv tr { display: block; }
    table.archiv thead { display: none; }
    table.archiv td { border: none; }
    table.archiv .actions { text-align: left; }
}
