@font-face {
  font-family: TWKEverett;
  src: url("/static/fonts/TWKEverett-Regular.woff2") format("woff2");
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: TWKEverett;
  src: url("/static/fonts/TWKEverett-Medium.woff2") format("woff2");
  font-weight: 500; font-display: swap;
}

/* Farben wie ascherl.at – die Marke ist hell, deshalb kein Dark-Mode. */
:root {
  --bg: #f4f4f4;
  --surface: #fff;
  --text: #003cd1;
  --muted: color-mix(in srgb, #003cd1 58%, #f4f4f4);
  --line: color-mix(in srgb, #003cd1 16%, #f4f4f4);
  --accent: #003cd1;
  --danger: #ff1e23;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 TWKEverett, "Helvetica Neue", -apple-system,
        BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: -.005em;
}

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

/* --- Kopfleiste --- */
.topbar {
  display: flex; align-items: center; gap: 26px;
  padding: 0 24px;
  height: 54px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.topbar .brand img { height: 19px; width: auto; display: block; }
.topbar .brand span {
  font-weight: 500; font-size: 15px; color: var(--muted);
  border-left: 1px solid var(--line); padding-left: 10px;
}
.login-logo { height: 22px; width: auto; display: block; margin-bottom: 18px; }
.topbar nav { display: flex; gap: 18px; }
.topbar nav a { color: var(--muted); text-decoration: none; font-size: 14px; }
.topbar nav a:hover { color: var(--text); }
.topbar .me {
  margin-left: auto; display: flex; align-items: center; gap: 14px;
  font-size: 13px; color: var(--muted);
}

main { max-width: 1080px; margin: 0 auto; padding: 26px 24px 60px; }

/* --- Seitenkopf --- */
.page-head {
  display: flex; align-items: baseline; gap: 16px;
  margin-bottom: 20px;
}
.page-head h1 { margin: 0; font-size: 23px; font-weight: 500; letter-spacing: -.015em; }
.page-head .count {
  font-size: 13px; font-weight: 500; color: var(--muted);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 0; padding: 1px 9px;
}
.page-head .btn { margin-left: auto; }
.back-link { margin-left: auto; font-size: 14px; text-decoration: none; }

/* --- Buttons --- */
.btn {
  display: inline-block;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 0;
  background: var(--accent);
  color: #fff;
  font: inherit; font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.small { padding: 7px 11px; font-size: 13px; font-weight: 500; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.icon-btn {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  border-radius: 0; width: 32px; height: 32px; cursor: pointer; font: inherit;
}
.linkish {
  border: 0; background: none; color: var(--accent);
  font: inherit; font-size: 13px; cursor: pointer; padding: 0;
}
.linkish.danger { color: var(--danger); }

/* --- Tabelle --- */
.grid {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0;
  overflow: hidden;
}
.grid th {
  text-align: left; font-size: 11.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  padding: 11px 14px; border-bottom: 1px solid var(--line);
}
.grid td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid tr:last-child td { border-bottom: 0; }
.grid tr.spacer td { padding: 0; border: 0; }
.grid .num { text-align: right; }
.grid .muted { color: var(--muted); }
.grid .strong { font-weight: 500; text-decoration: none; color: var(--text); }
.grid .slug { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.grid tr.inactive { opacity: .55; }
.grid .thumb { width: 48px; }
.grid .thumb img { border-radius: 50%; object-fit: cover; display: block; }
.grid .ini {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--line); color: var(--muted);
  font-size: 12px; font-weight: 600; text-transform: uppercase;
}
.row-actions { text-align: right; white-space: nowrap; font-size: 13px; }
.row-actions a, .row-actions button { text-decoration: none; margin-left: 14px; }
.tag {
  margin-left: 7px; font-size: 11px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 0; padding: 1px 5px;
}

/* --- Formular --- */
.cols { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
@media (max-width: 860px) { .cols { grid-template-columns: 1fr; } }

fieldset {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 16px 18px 18px;
  margin: 0 0 16px;
}
legend {
  padding: 0 6px; margin-left: -6px;
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
}
label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
label:last-child { margin-bottom: 0; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
label.check input { width: auto; margin: 0; }

input[type=text], input[type=email], input[type=password], input:not([type]),
textarea, select {
  display: block; width: 100%; margin-top: 4px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--bg);
  color: var(--text);
  font: inherit; font-size: 14px;
}
input[type=color] { margin-top: 4px; width: 60px; height: 34px; padding: 2px; border: 1px solid var(--line); border-radius: 0; background: var(--bg); }
input[type=file] { font-size: 13px; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 90px 1fr 1fr; gap: 12px; }
@media (max-width: 620px) { .row2, .row3 { grid-template-columns: 1fr; } }

.hint { margin: 6px 0 12px; font-size: 12.5px; color: var(--muted); }
.form-actions { display: flex; gap: 12px; align-items: center; margin-top: 4px; }

.link-row {
  display: grid; grid-template-columns: 120px 1fr 1.4fr 32px;
  gap: 8px; margin-bottom: 8px; align-items: center;
}
.link-row select, .link-row input { margin-top: 0; }
@media (max-width: 620px) { .link-row { grid-template-columns: 1fr; } }

/* --- Seitenspalte --- */
.photo-box { margin-bottom: 10px; }
.photo-box img { border-radius: 0; object-fit: cover; display: block; margin-bottom: 8px; }
.photo-empty {
  display: grid; place-items: center;
  width: 120px; height: 120px; border-radius: 0;
  border: 1px dashed var(--line); color: var(--muted); font-size: 12px;
  margin-bottom: 8px;
}
.pub-link {
  display: block; word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
  margin-bottom: 12px;
}
.qr-preview { display: block; border: 1px solid var(--line); border-radius: 0; background: #fff; margin-bottom: 12px; }
.logo-preview { max-width: 100%; max-height: 90px; margin-bottom: 10px; display: block; }
.side-actions { display: flex; flex-direction: column; gap: 7px; }
.stats { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.stats li { padding: 5px 0; border-bottom: 1px solid var(--line); }
.stats li:last-child { border: 0; }

/* --- Meldungen --- */
.flash {
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: 0; padding: 11px 14px; margin-bottom: 18px; font-size: 14px;
}
.flash.error, .error {
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  border-color: color-mix(in srgb, var(--danger) 35%, var(--line));
  color: var(--danger);
}
.empty {
  background: var(--surface); border: 1px solid var(--line); border-radius: 0;
  padding: 44px; text-align: center; color: var(--muted);
}
.empty .btn { margin-top: 12px; }

/* --- Login / 404 --- */
body.centered { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.login {
  width: 100%; max-width: 340px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 0; padding: 28px;
}
.login h1 { margin: 0; font-size: 19px; font-weight: 500; letter-spacing: -.02em; }
.login .sub { margin: 2px 0 20px; color: var(--muted); font-size: 13.5px; }
.login button { width: 100%; margin-top: 6px; padding: 11px; border: 0; border-radius: 0;
  background: var(--accent); color: #fff; font: inherit; font-weight: 500; cursor: pointer; }
.login .error { padding: 9px 12px; border-radius: 0; font-size: 13px; margin-bottom: 14px; }
.notfound { text-align: center; max-width: 380px; }
.notfound h1 { font-size: 20px; }
.notfound p { color: var(--muted); }

.ok {
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  padding: 9px 12px; font-size: 13px; margin-bottom: 14px;
}
.login .check { margin: 14px 0 4px; font-size: 13.5px; }
.login .back { margin: 14px 0 0; text-align: center; font-size: 13px; }
.login .btn { display: block; text-align: center; margin-top: 6px; }
.copybox {
  margin-top: 8px; width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
}

.new-user { margin-top: 22px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.inline-form label { margin: 0; flex: 1 1 170px; }
