:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --line: #e4e6eb;
  --line2: #eef0f3;
  --text: #1d1f24;
  --muted: #6b7280;
  --accent: #2f7de1;
  --accent-soft: #e8f1fd;
  --accent2: #7c4dff;
  --ok: #1f9d55;
  --ok-soft: #e6f6ec;
  --warn: #c27c0e;
  --bad: #d64545;
  --bad-soft: #fdecec;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  font-size: 15px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
.hidden { display: none !important; }

/* Logo */
.logo-mark { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-weight: 800;
  background: linear-gradient(135deg, #4fa8ff, #9a5cff); font-size: 18px; letter-spacing: -.5px; flex: none; }
.logo-mark.big { width: 64px; height: 64px; border-radius: 16px; font-size: 32px; }
.boot { height: 100vh; display: grid; place-items: center; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 40px 36px; width: 100%; max-width: 400px;
  text-align: center; box-shadow: var(--shadow); }
.login-card h1 { font-size: 24px; margin: 18px 0 6px; }
.login-card p { color: var(--muted); margin: 0 0 26px; line-height: 1.5; }
.btn-discord { display: inline-flex; gap: 10px; align-items: center; justify-content: center; width: 100%; padding: 12px 18px; border-radius: 10px;
  border: 0; background: #5865f2; color: #fff; font-weight: 600; cursor: pointer; font-size: 15px; }
.btn-discord:hover { background: #4752c4; }
.login .fehler { background: var(--bad-soft); color: var(--bad); padding: 10px 12px; border-radius: 10px; margin-bottom: 18px; font-size: 14px; }

/* Layout */
.shell { display: grid; grid-template-columns: 236px 1fr; height: 100vh; }
.side { background: #fbfbfc; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 16px 12px; gap: 4px; min-height: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand b { font-size: 15px; display: block; }
.brand small { color: var(--muted); font-size: 12px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: var(--text); font-weight: 500; }
.nav a:hover { background: var(--line2); }
.nav a.on { background: var(--accent-soft); color: var(--accent); }
.nav .ico { width: 20px; text-align: center; }
.nav .badge { margin-left: auto; }
.badge { background: var(--accent); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
.side .grow { flex: 1; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-top: 1px solid var(--line); margin-top: 8px; }
.me img { width: 34px; height: 34px; border-radius: 50%; }
.me .who { min-width: 0; flex: 1; }
.me .who b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .who small { color: var(--muted); font-size: 12px; }
.main { overflow: auto; min-width: 0; }
.page { padding: 28px 32px 60px; max-width: 1200px; margin: 0 auto; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; margin: 0; letter-spacing: -.3px; }
.page-head .sub { color: var(--muted); font-size: 14px; }
.page-head .spacer { flex: 1; }
.mobile-top { display: none; }

/* Elemente */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--card);
  cursor: pointer; font-weight: 500; font-size: 14px; white-space: nowrap; }
.btn:hover { background: #f8f9fa; border-color: #d6d9df; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #256bc4; }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--line2); }
.btn:disabled { opacity: .5; cursor: default; }
.iconbtn { border: 0; background: transparent; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; color: var(--muted); font-size: 18px; }
.iconbtn:hover { background: var(--line2); color: var(--text); }
input[type=text], input[type=search], textarea, select { border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 9px 11px; outline: none; width: 100%; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label.f { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 5px; font-weight: 500; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { padding: 14px 18px; border-bottom: 1px solid var(--line2); display: flex; align-items: center; gap: 10px; font-weight: 600; }
.card-b { padding: 14px 18px; }
.empty { color: var(--muted); text-align: center; padding: 34px 10px; }
.empty .big { font-size: 34px; display: block; margin-bottom: 8px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; background: var(--line2); font-size: 12px; color: #374151; }
.avatar { width: 24px; height: 24px; border-radius: 50%; vertical-align: middle; }
.muted { color: var(--muted); }
.row { display: flex; align-items: center; gap: 10px; }

/* Übersicht */
.hello { font-size: 28px; font-weight: 700; letter-spacing: -.4px; margin: 0 0 4px; }
.quick { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0 24px; }
.list-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line2); }
.list-item:last-child { border-bottom: 0; }
.list-item .t { flex: 1; min-width: 0; }
.list-item .t b { font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .t small { color: var(--muted); font-size: 12.5px; }

/* Dateien */
.spaces { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.spaces button { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 13px; cursor: pointer; font-size: 14px; }
.spaces button.on { background: var(--text); color: #fff; border-color: var(--text); }
.crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--text); padding: 3px 6px; border-radius: 6px; }
.crumbs a:hover { background: var(--line2); }
.toolbar { display: flex; gap: 8px; align-items: center; margin: 12px 0 14px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.toolbar input[type=search] { max-width: 220px; }
.files { position: relative; min-height: 260px; }
.files.drag::after { content: "Dateien hier loslassen zum Hochladen"; position: absolute; inset: 0; border: 2px dashed var(--accent); border-radius: var(--radius);
  background: rgba(232, 241, 253, .85); display: grid; place-items: center; color: var(--accent); font-weight: 600; font-size: 17px; z-index: 5; }
.ftable { width: 100%; border-collapse: collapse; }
.ftable th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); text-transform: uppercase; letter-spacing: .3px; }
.ftable td { padding: 9px 14px; border-bottom: 1px solid var(--line2); font-size: 14px; }
.ftable tr.f:hover td { background: #fafbfc; cursor: pointer; }
.ftable tr:last-child td { border-bottom: 0; }
.fname { display: flex; align-items: center; gap: 11px; min-width: 0; }
.fname span.n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ficon { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; font-size: 17px; flex: none; background: var(--line2); overflow: hidden; }
.ficon img { width: 100%; height: 100%; object-fit: cover; }
.ficon.ordner { background: #fff4d6; }
.ficon.dokument { background: var(--accent-soft); }
.ficon.plugin { background: #efe8ff; }
.ftable .act { width: 44px; text-align: right; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; padding: 14px; }
.tile { border: 1px solid var(--line2); border-radius: 11px; padding: 10px; cursor: pointer; background: #fff; position: relative; }
.tile:hover { border-color: #d6d9df; box-shadow: var(--shadow); }
.tile .thumb { height: 100px; border-radius: 8px; background: var(--line2); display: grid; place-items: center; font-size: 36px; overflow: hidden; margin-bottom: 8px; }
.tile .thumb img { width: 100%; height: 100%; object-fit: cover; }
.tile .n { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .s { font-size: 12px; color: var(--muted); }
.tile .iconbtn { position: absolute; top: 6px; right: 6px; background: rgba(255, 255, 255, .9); }

/* Menü */
.menu { position: fixed; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 5px; z-index: 60; min-width: 190px; }
.menu button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 8px 11px; border: 0; background: none; border-radius: 7px; cursor: pointer; text-align: left; font-size: 14px; }
.menu button:hover { background: var(--line2); }
.menu button.danger { color: var(--bad); }
.menu hr { border: 0; border-top: 1px solid var(--line2); margin: 4px 0; }

/* Dialoge */
.overlay { position: fixed; inset: 0; background: rgba(17, 24, 39, .38); display: grid; place-items: center; z-index: 50; padding: 20px; }
.dialog { background: #fff; border-radius: 16px; width: 100%; max-width: 480px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; max-height: 90vh; }
.dialog.wide { max-width: 900px; }
.dialog-h { padding: 18px 22px 6px; font-size: 18px; font-weight: 650; display: flex; align-items: center; gap: 10px; }
.dialog-h .spacer { flex: 1; }
.dialog-b { padding: 6px 22px 10px; overflow: auto; }
.dialog-f { padding: 14px 22px 18px; display: flex; gap: 8px; justify-content: flex-end; }
.preview-img { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto; border-radius: 8px; }
.preview-text { width: 100%; height: 60vh; font-family: ui-monospace, Consolas, monospace; font-size: 13px; white-space: pre; resize: vertical; }
.pick-list { border: 1px solid var(--line); border-radius: 10px; max-height: 300px; overflow: auto; }
.pick-list .p { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line2); cursor: pointer; }
.pick-list .p:last-child { border-bottom: 0; }
.pick-list .p:hover { background: #fafbfc; }
.pick-list .p.on { background: var(--accent-soft); }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.tpl { border: 1px solid var(--line); border-radius: 11px; padding: 14px 10px; text-align: center; cursor: pointer; background: #fff; font-size: 13.5px; }
.tpl .e { font-size: 26px; display: block; margin-bottom: 6px; }
.tpl.on { border-color: var(--accent); background: var(--accent-soft); }

/* Uploads */
.uploads { position: fixed; right: 20px; bottom: 20px; width: 320px; z-index: 40; }
.up { background: #fff; border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; box-shadow: var(--shadow-lg); margin-top: 8px; font-size: 13px; }
.up .bar { height: 5px; background: var(--line2); border-radius: 9px; overflow: hidden; margin-top: 7px; }
.up .bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.up.done .bar i { background: var(--ok); }
.up.fail .bar i { background: var(--bad); }

/* Toasts */
#toasts { position: fixed; top: 18px; right: 18px; z-index: 70; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #1d1f24; color: #fff; border-radius: 11px; padding: 11px 15px; font-size: 14px; box-shadow: var(--shadow-lg); max-width: 360px; animation: tin .2s ease; }
.toast.bad { background: var(--bad); }
@keyframes tin { from { opacity: 0; transform: translateY(-6px); } }

/* Aufgaben */
.todo-layout { display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: start; }
.groups a { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 9px; color: var(--text); }
.groups a:hover { background: var(--line2); }
.groups a.on { background: var(--card); box-shadow: var(--shadow); border: 1px solid var(--line); }
.groups a .c { margin-left: auto; font-size: 12px; color: var(--muted); }
.addform { display: grid; grid-template-columns: 1fr 140px 180px auto; gap: 8px; padding: 14px; }
.addform .full { grid-column: 1 / -1; }
.task { display: flex; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line2); align-items: flex-start; }
.task:last-child { border-bottom: 0; }
.task .check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #c7cbd3; background: #fff; cursor: pointer; flex: none; margin-top: 1px; display: grid; place-items: center; font-size: 12px; color: #fff; }
.task .check:hover { border-color: var(--ok); }
.task.done .check { background: var(--ok); border-color: var(--ok); }
.task .body { flex: 1; min-width: 0; }
.task .tt { font-weight: 500; }
.task.done .tt { text-decoration: line-through; color: var(--muted); }
.task .dd { color: var(--muted); font-size: 13.5px; margin-top: 3px; white-space: pre-wrap; }
.task .meta { display: flex; gap: 8px; align-items: center; margin-top: 7px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.prio { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.prio.hoch { background: var(--bad); }
.prio.normal { background: #e0b100; }
.prio.niedrig { background: var(--ok); }
.section-t { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; padding: 16px 16px 6px; }

/* Editor */
.editor-page { display: flex; flex-direction: column; height: 100vh; }
.editor-top { display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: #fff; }
.editor-top input.title { border: 0; font-size: 18px; font-weight: 600; padding: 6px 8px; max-width: 420px; }
.editor-top input.title:focus { box-shadow: none; background: var(--line2); }
.editor-top .status { font-size: 13px; color: var(--muted); }
.peers { display: flex; }
.peers span { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 700; margin-left: -6px; border: 2px solid #fff; }
.editor-wrap { flex: 1; overflow: auto; background: var(--bg); padding: 24px 16px 80px; }
.editor-paper { max-width: 860px; margin: 0 auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.editor-paper .ql-toolbar.ql-snow { border: 0; border-bottom: 1px solid var(--line2); position: sticky; top: -24px; background: #fff; z-index: 3; border-radius: 12px 12px 0 0; padding: 10px 14px; }
.editor-paper .ql-container.ql-snow { border: 0; font-size: 16px; font-family: inherit; }
.editor-paper .ql-editor { min-height: 70vh; padding: 36px 56px; line-height: 1.6; }
.editor-paper .ql-editor h1 { font-size: 28px; }
.ql-editor li[data-list=checked] > .ql-ui, .ql-editor li[data-list=unchecked] > .ql-ui { color: var(--accent); }

/* Handy */
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 30% 0 0; z-index: 45; transform: translateX(-102%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .side.open { transform: none; }
  .mobile-top { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; z-index: 10; }
  .page { padding: 18px 14px 60px; }
  .todo-layout { grid-template-columns: 1fr; }
  .groups { display: flex; overflow: auto; gap: 4px; }
  .groups a { white-space: nowrap; }
  .addform { grid-template-columns: 1fr; }
  .ftable .hide-m { display: none; }
  .editor-paper .ql-editor { padding: 22px 18px; }
  .uploads { left: 14px; right: 14px; width: auto; }
}
