:root {
  --bg: #f4f3f7; --panel: #ffffff; --ink: #1e1b2e; --muted: #6e6880; --line: #e4e1ec;
  --violet: #6d28d9; --violet-soft: #ede9f7; --violet-ink: #4c1d95; --magenta: #c026d3;
  --ok: #1a7f4e; --ok-soft: #e7f4ec; --warn: #b45309; --warn-soft: #fdf1dc; --bad: #b42318; --bad-soft: #fde9e7;
  --grey-soft: #eef0f3;
  --brand: #023c58; --accent: #ffd35c;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: 'Hanken Grotesk', 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--ink); font-size: 14px; }
a { color: var(--violet); }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
.app { min-height: 100vh; }

.gate { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.gate-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px 32px; width: 380px; text-align: center; color: var(--muted); }
.gate-logo { font-weight: 800; font-size: 18px; color: var(--ink); margin-bottom: 10px; display: flex; gap: 10px; justify-content: center; align-items: center; }
.dot { width: 22px; height: 22px; border-radius: 7px; background: var(--violet); display: inline-block; }

.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 22px 14px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.logo { display: flex; align-items: center; gap: 10px; padding: 0 8px; font-weight: 800; font-size: 17px; }
.client-chip { display: flex; align-items: center; gap: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; }
.client-chip .mark { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 800; background: var(--brand); color: var(--accent); }
.client-chip .name { font-weight: 700; font-size: 13.5px; }
.client-chip .sub { font-size: 11.5px; color: var(--muted); }
.client-chip { position: relative; }
.client-chip .pick { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.client-chip .chip-select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 16px; }
.client-chip:has(.chip-select):hover { border-color: #c9c2dd; }
.client-chip:has(.chip-select:focus-visible) { outline: 2px solid var(--violet); outline-offset: 2px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav button { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--muted); font-weight: 500; text-align: left; }
.nav button svg { flex: none; }
.nav button.active { background: var(--violet-soft); color: var(--violet-ink); font-weight: 700; }
.nav .count { margin-left: auto; background: var(--warn); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 2px 8px; }
.side .me { margin-top: auto; border-top: 1px solid var(--line); padding: 12px 8px 0; display: flex; gap: 10px; align-items: center; font-size: 12.5px; }
.avatar { width: 30px; height: 30px; border-radius: 999px; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; background: var(--magenta); font-size: 12.5px; flex: none; }
.live { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 6px; padding: 0 8px; }
.live .pulse { width: 8px; height: 8px; border-radius: 999px; background: var(--ok); box-shadow: 0 0 0 0 rgba(26,127,78,.5); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(26,127,78,.45);} 70% { box-shadow: 0 0 0 8px rgba(26,127,78,0);} 100% { box-shadow: 0 0 0 0 rgba(26,127,78,0);} }

.main { padding: 26px 34px 60px; display: flex; flex-direction: column; gap: 22px; max-width: 1280px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.head h1 { margin: 0; font-size: 23px; font-weight: 800; }
.head .sub { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.cta { display: inline-flex; align-items: center; gap: 8px; background: var(--brand); color: #fff; border-radius: 10px; padding: 11px 16px; font-weight: 700; }
.cta svg { stroke: var(--accent); }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; cursor: pointer; }
.kpi .n { font-size: 28px; font-weight: 800; }
.kpi .l { font-size: 13px; font-weight: 600; margin-top: 2px; }
.kpi.warn .n { color: var(--warn); } .kpi.grey .n { color: var(--muted); } .kpi.ok .n { color: var(--ok); }

.section-head { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.section-head h2 { margin: 0; font-size: 15.5px; font-weight: 800; }
.section-head .hint { color: var(--muted); font-size: 12.5px; }

.queue { display: flex; flex-direction: column; gap: 8px; }
.qitem { display: flex; gap: 12px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; }
.qitem:hover { border-color: #c9c2dd; }
.qitem .bullet { width: 9px; height: 9px; border-radius: 999px; background: var(--warn); margin-top: 6px; flex: none; }
.qitem .t { font-weight: 700; font-size: 14px; }
.qitem .s { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.qitem .where { margin-left: auto; flex: none; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.where.hub { background: var(--violet-soft); color: var(--violet-ink); }
.where.klartext { background: #e6f0f6; color: var(--brand); }
.empty { background: var(--panel); border: 1px dashed var(--line); border-radius: 12px; padding: 18px; color: var(--muted); font-size: 13.5px; }

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; min-height: 112px; }
.card:hover { border-color: #c9c2dd; }
.card .top { display: flex; align-items: center; justify-content: space-between; }
.card .top svg { stroke: var(--brand); }
.card .t { font-weight: 700; font-size: 14px; line-height: 1.3; }
.card .s { font-size: 12.5px; color: var(--muted); }
.pill { font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.pill.freigabe, .pill.open { background: var(--warn-soft); color: var(--warn); }
.pill.freigegeben, .pill.approved, .pill.geplant, .pill.veroeffentlicht { background: var(--ok-soft); color: var(--ok); }
.pill.aenderung, .pill.changes { background: var(--bad-soft); color: var(--bad); }
.pill.in_arbeit, .pill.entwurf { background: var(--grey-soft); color: var(--muted); }

.batch { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.batch .row { display: flex; align-items: center; gap: 14px; }
.batch .t { font-weight: 800; font-size: 14.5px; }
.batch .s { color: var(--muted); font-size: 12.5px; }
.bar { flex: 1; height: 8px; background: var(--grey-soft); border-radius: 999px; overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; }
.bar .ok { background: var(--ok); } .bar .ch { background: var(--bad); }
.batch .actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.btn { display: inline-flex; align-items: center; gap: 8px; border-radius: 10px; padding: 9px 14px; font-weight: 700; font-size: 13px; border: 1.5px solid var(--line); background: var(--panel); }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn.ghost { color: var(--muted); }
.btn.big { padding: 14px 24px; font-size: 15px; border-radius: 12px; }
.items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; background: var(--bg); cursor: pointer; }
.item:hover { background: #ece9f3; }
.item .n { font-size: 13px; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .thumb { width: 34px; height: 34px; border-radius: 7px; background: var(--brand); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; flex: none; overflow: hidden; }
.item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.filters { display: flex; gap: 6px; }
.filters button { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--grey-soft); color: var(--muted); }
.filters button.active { background: var(--brand); color: #fff; }
.more { font-size: 12.5px; color: var(--violet); font-weight: 700; padding: 6px 0; }

.events { display: flex; flex-direction: column; gap: 6px; }
.event { display: flex; gap: 10px; align-items: baseline; font-size: 13px; padding: 8px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.event .when { color: var(--muted); font-size: 12px; flex: none; width: 120px; }

/* Detail-Schublade (Variante C) */
.drawer-bg { position: fixed; inset: 0; background: rgba(20, 16, 40, .35); display: flex; justify-content: flex-end; z-index: 20; }
.drawer { width: min(760px, 100%); height: 100%; background: var(--bg); overflow: auto; padding: 26px 30px 40px; display: flex; flex-direction: column; gap: 16px; box-shadow: -12px 0 40px rgba(0,0,0,.15); }
.drawer .crumb { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.drawer .crumb .type { background: var(--brand); color: #fff; border-radius: 999px; padding: 4px 12px; font-weight: 700; font-size: 12px; }
.drawer .close { margin-left: auto; font-weight: 700; color: var(--muted); }
.paper { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 26px 30px; display: flex; flex-direction: column; gap: 12px; }
.paper h2 { margin: 0; font-size: 22px; line-height: 1.25; }
.paper .meta { font-size: 12.5px; color: var(--muted); }
.paper .body { white-space: pre-wrap; line-height: 1.6; font-size: 15px; color: #3a3d44; }
.paper textarea { width: 100%; min-height: 220px; font: inherit; font-size: 15px; line-height: 1.6; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; resize: vertical; }
.status-line { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.decide { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.note { flex: 1; min-width: 260px; }
.note input { width: 100%; font: inherit; border: 1.5px solid var(--line); border-radius: 10px; padding: 11px 12px; }
.klartext-box { background: #e6f0f6; border: 1px solid #cfe0ea; border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.klartext-box .t { font-weight: 800; color: var(--brand); }
.klartext-box .s { font-size: 13px; color: #2e4a5c; line-height: 1.5; }
.comments { display: flex; flex-direction: column; gap: 8px; }
.comment { display: flex; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 13.5px; line-height: 1.45; }
.comment .who { font-weight: 700; }
.comment .when { color: var(--muted); font-size: 12px; margin-left: 6px; }
.comment-form { display: flex; gap: 8px; }
.comment-form input { flex: 1; font: inherit; border: 1.5px solid var(--line); border-radius: 10px; padding: 11px 12px; background: var(--panel); }

.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { background: var(--ink); color: #fff; border-radius: 10px; padding: 10px 14px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.2); animation: toastin .2s ease-out; }
@keyframes toastin { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .side .me, .live { display: none; }
  .nav { flex-direction: row; }
  .main { padding: 18px 16px 60px; }
  .kpis, .grid, .items { grid-template-columns: 1fr; }
  .drawer { padding: 18px 16px; }
}

/* Anmeldung */
.login { display: flex; flex-direction: column; gap: 12px; text-align: left; margin-top: 8px; }
.login label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.login input { font: inherit; font-size: 14px; border: 1.5px solid var(--line); border-radius: 10px; padding: 11px 12px; color: var(--ink); }
.gate-msg { font-size: 13px; color: var(--muted); min-height: 18px; text-align: center; }
.gate-link { font-size: 12.5px; text-align: center; color: var(--muted); }
.side .me .logout { margin-left: auto; color: var(--muted); padding: 6px; border-radius: 8px; }
.side .me .logout:hover { background: var(--bg); color: var(--ink); }
.nav .count.soft { background: var(--violet-soft); color: var(--violet-ink); }

/* Kopfzeilen-Aktionen, Links als Knöpfe */
.head-actions { display: flex; gap: 8px; }
.linkbtn { font: inherit; font-size: 12.5px; font-weight: 700; color: var(--violet); padding: 0; }
.linkbtn.danger, .btn.danger { color: var(--bad); }
.pubs { color: var(--violet-ink); font-weight: 600; margin-top: 2px; }
.item .n .pubs { font-size: 11.5px; }

/* Dateien */
.files { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--line); padding-top: 12px; }
.file { display: flex; align-items: center; gap: 12px; font-size: 13.5px; }
.file a:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); text-decoration: none; font-weight: 600; }
.file .s { color: var(--muted); font-size: 12px; }
.upload { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--violet); cursor: pointer; padding: 8px 0; }

/* Veröffentlichung */
.pubbox { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; display: flex; flex-direction: column; gap: 8px; }
.pubbox .t { font-weight: 800; }
.pubbox .s { font-size: 13px; color: var(--muted); }
.pubform { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pubform input { font: inherit; font-size: 13px; border: 1.5px solid var(--line); border-radius: 10px; padding: 9px 11px; }
.pubform input[type="datetime-local"] { color: var(--ink); }

/* Kalender */
.cal { display: flex; flex-direction: column; gap: 6px; }
.cal-day { font-weight: 800; font-size: 13.5px; margin-top: 12px; }
.cal-row { display: flex; align-items: center; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; cursor: pointer; }
.cal-row.done { opacity: .7; }
.cal-time { font-weight: 700; width: 46px; flex: none; }
.cal-title { font-weight: 600; flex: 1; }
.cal-meta { color: var(--muted); font-size: 12.5px; }

/* Formulare */
.form { gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.form input, .form select, .form textarea { font: inherit; font-size: 14px; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--ink); background: #fff; }
.form textarea { resize: vertical; line-height: 1.55; }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form .check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-weight: 500; }
.form .check input { width: auto; }
@media (max-width: 900px) { .form .two { grid-template-columns: 1fr; } .pubform { flex-direction: column; align-items: stretch; } }
