:root {
  --bg: #121214; --panel: #1b1b1f; --panel2: #232328; --line: #303037; --text: #ececf0; --muted: #9a9aa6;
  --accent: #ff3d5a; --red: #ff5a5f; --ok: #3ccf8e; --warn: #f5b13d; --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; min-width: 0;
}
input:focus, select:focus, textarea:focus, [contenteditable]:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); padding: 0; }
input:disabled, select:disabled { opacity: .6; }
label { color: var(--muted); font-size: 12px; display: flex; flex-direction: column; gap: 4px; }
label.inline { flex-direction: row; align-items: center; gap: 7px; font-size: 13px; color: var(--text); }
button {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 7px; padding: 7px 12px; cursor: pointer; white-space: nowrap;
}
button:hover { border-color: #55555f; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover { filter: brightness(1.1); }
button.ghost { background: none; border-color: transparent; color: var(--muted); }
button.ghost:hover { color: var(--text); border-color: var(--line); }
button.danger { color: var(--red); }
button.small { padding: 3px 8px; font-size: 12px; }
button:disabled { opacity: .5; cursor: default; }

header.top {
  display: flex; align-items: center; gap: 18px; padding: 0 20px; height: 54px; border-bottom: 1px solid var(--line);
  background: #0d0d0f; position: sticky; top: 0; z-index: 20;
}
.logo { font-weight: 800; letter-spacing: .02em; display: flex; align-items: center; gap: 8px; text-decoration: none; }
.logo b { color: var(--accent); }
nav.main { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
nav.main a { text-decoration: none; padding: 6px 11px; border-radius: 7px; color: var(--muted); white-space: nowrap; }
nav.main a.active, nav.main a:hover { color: var(--text); background: var(--panel2); }
.user { color: var(--muted); font-size: 12px; display: flex; gap: 8px; align-items: center; }

main { max-width: 1280px; margin: 0 auto; padding: 22px 20px 80px; }
h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { align-items: flex-end; }
.spacer { flex: 1; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel + .panel { margin-top: 16px; }
.pagehead { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.pagehead .sub { color: var(--muted); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--text); border-color: var(--accent); }

table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
tr:hover td { background: #1f1f24; }
td.center, th.center { text-align: center; }
.tablewrap { overflow-x: auto; }
.name { font-weight: 600; }
.name.unconf { color: var(--red); }

.dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--red); background: transparent; padding: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.dot.ok { border-color: var(--ok); background: var(--ok); }
.dot.ok::after { content: "✓"; color: #08150f; font-size: 13px; font-weight: 800; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 11px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); }
.pill.ok { color: var(--ok); border-color: #2a5b45; }
.pill.red { color: var(--red); border-color: #6a2a2d; }
.pill.warn { color: var(--warn); border-color: #6a5427; }
.stats { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 14px; }
.stat { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 11px; font-size: 12px; color: var(--muted); }
.stat b { color: var(--text); font-size: 14px; margin-right: 4px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-decoration: none; display: block; transition: border-color .15s; }
.card:hover { border-color: var(--accent); }
.card .brand { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 700; }
.card .title { font-size: 18px; font-weight: 700; margin: 2px 0 6px; }
.card.archived { opacity: .55; }

.addbar { position: relative; flex: 1; min-width: 260px; }
.addbar input { width: 100%; padding: 10px 12px; font-size: 15px; }
.suggest { position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; z-index: 30; max-height: 320px; overflow-y: auto; box-shadow: 0 10px 30px #0008; }
.suggest div { padding: 8px 12px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.suggest div.sel, .suggest div:hover { background: #2e2e35; }
.suggest .hint { color: var(--muted); font-size: 12px; }
.warnbox { background: #2a2214; border: 1px solid #6a5427; color: #f5d393; border-radius: 8px; padding: 10px 12px; margin-top: 10px; }
.warnbox button { margin: 6px 6px 0 0; }

/* Manuskript-Vorschau */
.paper { background: #fff; color: #111; border-radius: 6px; padding: 40px 48px; max-width: 820px; box-shadow: 0 10px 40px #0007; }
.paper.dark { background: #262626; color: #f2f2f2; }
.paper.dark span[style*="FFF2A8"] { background: #3d3a10 !important; }
.ms-layout { display: grid; grid-template-columns: 280px 1fr; gap: 20px; align-items: start; }
.ms-layout .panel { position: sticky; top: 70px; }
.ms-layout .panel label.inline { margin: 6px 0; }
@media (max-width: 860px) { .ms-layout { grid-template-columns: 1fr; } .ms-layout .panel { position: static; } .paper { padding: 24px; } }

.paste { min-height: 220px; max-height: 420px; overflow: auto; background: #fff; color: #111; border-radius: 8px; padding: 14px; border: 1px solid var(--line); }
.paste:empty::before { content: attr(data-placeholder); color: #888; }
.list-edit { display: flex; flex-direction: column; gap: 6px; }
.list-edit .row { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.list-edit input[type=text] { flex: 1; }

.login { max-width: 360px; margin: 12vh auto; }
.login .panel { display: flex; flex-direction: column; gap: 12px; padding: 26px; }
.err { color: var(--red); font-size: 13px; }
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #2d2d33; border: 1px solid var(--line); padding: 10px 16px; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 99; box-shadow: 0 8px 24px #0009; }
#toast.show { opacity: 1; }
#toast.error { border-color: var(--red); color: #ffc9cb; }
.logrow { display: grid; grid-template-columns: 140px 110px 1fr; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.logrow .when { color: var(--muted); }
.empty { color: var(--muted); padding: 30px; text-align: center; }
select.compact { padding: 4px 6px; font-size: 13px; }
td input.inline-edit { background: transparent; border-color: transparent; width: 100%; }
td input.inline-edit:hover { border-color: var(--line); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: none; border-radius: 0; background: var(--panel2); color: var(--muted); }
.seg button.on { background: var(--accent); color: #fff; }
tr.tierhead td { background: var(--panel2); font-weight: 700; padding: 8px 10px; }
tr.tierhead.droptier td { box-shadow: inset 0 -3px 0 var(--accent); }
tr.prow.dropbefore td { box-shadow: inset 0 3px 0 var(--accent); }
tr.prow.dropafter td { box-shadow: inset 0 -3px 0 var(--accent); }
tr.prow.dragging { opacity: .4; }
td.handle { white-space: nowrap; color: var(--muted); }
td.handle .grip { cursor: grab; font-size: 16px; margin-right: 6px; user-select: none; }
td.handle b { display: inline-block; min-width: 22px; color: var(--text); }
tr.cutline td { padding: 2px 10px; font-size: 11px; color: var(--accent); border-bottom: 2px dashed var(--accent); background: none; }
/* Kopfzeile langer Tabellen beim Scrollen anpinnen (unter der Navigationsleiste) */
th { position: sticky; top: 54px; z-index: 5; background: var(--bg); box-shadow: inset 0 -1px 0 var(--line); }
.panel th { background: var(--panel); }
.tablewrap { overflow: visible; }
@media (max-width: 900px) { .tablewrap { overflow-x: auto; } th { position: static; } }
