:root {
    --blue: #007aff;
    --bg: #f4f5f7;
    --card: #fff;
    --text: #1c1c1e;
    --muted: #6b7280;
    --border: #e2e4e9;
    --danger: #d92d20;
    --ok: #12b76a;
    --warn: #f79009;
    --promo-blue: #007aff;
    --promo-red: #d92d20;
    --promo-green: #12b76a;
    --promo-orange: #f79009;
    --promo-black: #1c1c1e;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--blue); }

.topbar {
    display: flex; justify-content: space-between; align-items: center;
    background: var(--blue); color: #fff; padding: 14px 24px;
}
.topbar .brand { color: #fff; font-weight: 600; text-decoration: none; }
.topbar form { margin: 0; }

main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; }

.card { background: var(--card); border-radius: 12px; padding: 20px 24px; margin-bottom: 20px; box-shadow: 0 1px 3px rgb(0 0 0 / 0.06); }
.card.narrow { max-width: 420px; margin: 48px auto; }
h1 { font-size: 1.5rem; margin: 0 0 12px; }
h2 { font-size: 1.15rem; margin: 0 0 16px; color: var(--blue); }
.key code { font-size: 1.3rem; letter-spacing: 0.05em; }
.muted { color: var(--muted); }
.error { color: var(--danger); font-weight: 500; }
.confirm-hint { color: var(--danger); font-weight: 600; margin: .5rem 0 0; }
.flash { background: #e8f2ff; border-left: 4px solid var(--blue); padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; }

label { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; font-weight: 500; }
input, select, textarea { font: inherit; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: -1px; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.grid .full { grid-column: 1 / -1; }
form.inline { display: flex; gap: 6px; margin: 0; }
form.inline input { padding: 5px 8px; min-width: 0; }

button { font: inherit; font-weight: 600; background: var(--blue); color: #fff; border: 0; border-radius: 999px; padding: 10px 22px; cursor: pointer; }
button.small { padding: 5px 12px; font-size: 0.85rem; }
button.secondary { background: #e8f2ff; color: var(--blue); }
button.danger { background: #fdecea; color: var(--danger); }
button.link { background: none; color: #fff; padding: 0; font-weight: 500; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 0.8rem; text-transform: uppercase; color: var(--muted); font-weight: 600; }
tr.revoked-row { opacity: 0.55; }

.badge { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; vertical-align: middle; }
.badge.active { background: #e7f8ef; color: var(--ok); }
.badge.suspended, .badge.expired { background: #fef3e2; color: var(--warn); }
.badge.revoked { background: #fdecea; color: var(--danger); }

fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; margin: 0; display: flex; flex-direction: column; gap: 10px; }
legend { font-size: 0.9rem; font-weight: 600; padding: 0 6px; }
label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 400; }
label.check input { width: 18px; height: 18px; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.inline-form input { flex: 1 1 240px; }
td.actions { display: flex; gap: 6px; justify-content: flex-end; }
td.actions form { margin: 0; }
.invite { background: #e7f8ef; border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; }
.invite p { margin: 4px 0; }
input.copy { width: 100%; font-family: ui-monospace, monospace; font-size: 0.85rem; }

/* Kundenportal */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-top: 8px; }
.stat { background: var(--bg); border-radius: 10px; padding: 12px 16px; }
.stat .label { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; font-weight: 600; }
.stat .value { font-size: 1.3rem; font-weight: 600; margin-top: 4px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.status::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.status.online::before { background: var(--ok); }
.status.offline { color: var(--muted); }
.url-cell { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sync { font-size: 0.85rem; }
.sync.pending { color: var(--warn); }
.sync.done { color: var(--ok); }
.form-section { border-top: 1px solid var(--border); padding-top: 20px; margin-top: 20px; }
.form-section:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input[type=range] { flex: 1; padding: 0; }
.range-row output { min-width: 3.5em; text-align: right; font-weight: 600; }
.radio-row { display: flex; gap: 18px; flex-wrap: wrap; }
.radio-row label { flex-direction: row; align-items: center; gap: 6px; font-weight: 400; }
.hint { font-size: 0.8rem; color: var(--muted); font-weight: 400; }
.sticky-actions { position: sticky; bottom: 0; background: var(--card); padding: 16px 0 4px; display: flex; gap: 12px; align-items: center; }
[hidden] { display: none !important; }
a.button { display: inline-block; font-weight: 600; background: var(--blue); color: #fff; border-radius: 999px; padding: 10px 22px; text-decoration: none; }
a.button.small { padding: 5px 14px; font-size: 0.85rem; white-space: nowrap; }
.label-text { display: block; font-size: 0.9rem; font-weight: 500; margin-bottom: 8px; }
.form-section h2 { margin-bottom: 0; }
.topnav { display: flex; align-items: center; gap: 4px; }
.topnav a { color: rgb(255 255 255 / 0.85); text-decoration: none; font-weight: 500; padding: 6px 12px; border-radius: 999px; }
.topnav a.active, .topnav a:hover { background: rgb(255 255 255 / 0.18); color: #fff; }
.topnav form { margin-left: 12px; }
.thumb { width: 72px; height: 48px; object-fit: cover; border-radius: 6px; background: var(--bg); display: block; }
.thumb.empty { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 0.75rem; }
.preview-image { max-width: 320px; max-height: 200px; border-radius: 8px; display: block; margin-bottom: 8px; }
.color-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: middle; margin-right: 6px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.section-head h1, .section-head h2 { margin: 0; }
.category-row td { background: var(--bg); font-weight: 600; font-size: 0.85rem; color: var(--muted); text-transform: uppercase; }
tr.inactive-row { opacity: 0.5; }
