:root {
    --bg: #f3f6f4;
    --card-bg: #ffffff;
    --text: #14201a;
    --muted: #5a6b62;
    --border: #d7e0da;
    --accent: #1f6b4a;
    --accent-text: #ffffff;
    --tk: #1f6b4a;
    --ref: #245b8a;
    --warn-bg: #fff4e5;
    --warn-border: #f5a623;
    --warn-ink: #92400e;
    --danger: #b3261e;
    --success: #1f6b4a;
    --shadow: 0 10px 30px rgba(20, 32, 26, 0.08);
    --radius: 14px;
    --glow-1: #d9efe4;
    --glow-2: #d6e5f5;
    --input-bg: #fbfcfb;
    --success-bg: #e7f6ee;
    --success-border: #b7e0c8;
    --danger-bg: #fdecea;
    --danger-border: #f5c2bd;
    --lizenz-bg: #eef2ff;
    --lizenz-border: #c9d9ff;
    --topbar-bg: rgba(255, 255, 255, 0.85);
}

:root[data-theme="dark"] {
    --bg: #14191b;
    --card-bg: #1d2426;
    --text: #e7ecec;
    --muted: #93a19d;
    --border: #313a3b;
    --accent: #2f9d6c;
    --accent-text: #ffffff;
    --tk: #2f9d6c;
    --ref: #4f8fd1;
    --warn-bg: #2f2410;
    --warn-border: #a5731f;
    --warn-ink: #e7b565;
    --danger: #e08079;
    --success: #3db67d;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    --glow-1: rgba(47, 157, 108, 0.07);
    --glow-2: rgba(79, 143, 209, 0.07);
    --input-bg: #171d1f;
    --success-bg: #12281d;
    --success-border: #1f4a34;
    --danger-bg: #34201d;
    --danger-border: #5c342f;
    --lizenz-bg: #17202f;
    --lizenz-border: #2a3c56;
    --topbar-bg: rgba(20, 25, 27, 0.9);
}

* { box-sizing: border-box; }

a { color: var(--accent); }
a:visited { color: var(--accent); }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 15px;
    line-height: 1.45;
    color: var(--text);
    min-height: 100vh;
    background:
        radial-gradient(1200px 500px at 10% -10%, var(--glow-1) 0%, transparent 55%),
        radial-gradient(900px 400px at 100% 0%, var(--glow-2) 0%, transparent 50%),
        var(--bg);
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: var(--topbar-bg);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.01em;
}

.topbar nav a {
    margin-left: 16px;
    color: var(--accent);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.theme-toggle {
    margin: 0 0 0 16px;
    padding: 4px 8px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: none;
    font-size: 14px;
    line-height: 1.4;
    cursor: pointer;
}
.theme-toggle:hover { background: var(--bg); }

main {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 16px 60px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    margin-bottom: 16px;
}

h1 {
    font-size: clamp(1.4rem, 4vw, 1.7rem);
    letter-spacing: -0.02em;
    margin: 0 0 10px;
}

.eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.72rem;
    color: var(--accent);
    font-weight: 700;
}

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

.inline-form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 6px 12px 0 0;
}

label { display: block; font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 12px; }

input[type="text"], input[type="password"], select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    margin-top: 4px;
    font-family: inherit;
    background: var(--input-bg);
    color: var(--text);
}
input[type="text"]:focus, input[type="password"]:focus, select:focus {
    outline: 2px solid color-mix(in srgb, var(--accent) 35%, var(--card-bg));
    border-color: var(--accent);
}

button {
    background: var(--accent);
    color: var(--accent-text);
    border: none;
    border-radius: 10px;
    padding: 11px 18px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 12px;
    box-shadow: 0 8px 18px rgba(31, 107, 74, 0.25);
}
button:hover { opacity: 0.92; }
button:active { transform: translateY(1px); }

.btn-link {
    display: inline-block;
    background: var(--card-bg);
    color: var(--accent);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    margin-top: 6px;
}
.btn-link:hover { background: var(--bg); }

.login-card { max-width: 340px; margin: 40px auto; }

.flashes { list-style: none; padding: 0; margin: 0 0 16px; }
.flash {
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 8px;
    font-size: 14px;
    border: 1px solid transparent;
}
.flash-success { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.flash-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.flash-warning { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-border); }

.table-scroll { overflow-x: auto; }

table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }

tr.row-conflict { background: var(--warn-bg); }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    color: var(--accent-text);
    font-size: 0.72rem;
    font-weight: 700;
}
.badge.tk { background: var(--tk); }
.badge.ref { background: var(--ref); }
.badge-lizenz { background: var(--lizenz-bg); color: var(--accent); border: 1px solid var(--lizenz-border); }
.badge-warn { background: var(--warn-bg); color: var(--warn-ink); border: 1px solid var(--warn-border); }

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 6px;
}

.when { color: var(--muted); font-size: 0.9rem; }
.match { margin: 4px 0; font-weight: 700; }
.meta { margin: 2px 0; color: var(--muted); font-size: 0.88rem; }

.duty-label { margin: 6px 0; font-size: 14px; }

.person-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.person-form label { flex: 1 1 160px; }
.person-form button { align-self: flex-end; }

h2 { font-size: 1.05rem; margin: 0 0 8px; }

.settings-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 4px; }
.settings-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg);
    border-radius: 8px;
    font-size: 14px;
}
.settings-list form { margin: 0; }

.json-editor {
    width: 100%;
    font-family: "SFMono-Regular", Consolas, Menlo, monospace;
    font-size: 12.5px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-top: 6px;
    background: var(--input-bg);
    color: var(--text);
}

.btn-danger-link {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 13px;
    font-weight: 600;
    padding: 4px 8px;
    margin: 0;
    box-shadow: none;
    cursor: pointer;
}
.btn-danger-link:hover { text-decoration: underline; }

.row-actions { display: flex; gap: 10px; white-space: nowrap; }
.row-actions form { display: inline; }
.row-actions .btn-link { padding: 6px 10px; font-size: 12.5px; margin: 0; }

.team-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.team-list a {
    display: block;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
}
.team-list a:hover { background: var(--bg); color: var(--accent); }
