/* ============================================================
   Cortex — Wanlickhus Corporate Design
   Schrift: Outfit (selbst gehostet). Icons: Lucide.
   Token-Basis: Rose · Amber · Royal Blue · Greige (CD v3).
   ============================================================ */

@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/static/fonts/outfit-var.woff2') format('woff2');
}

:root {
  /* --- Wanlick-Primitive (Auszug) --- */
  --blue-900: #0D0B4C;  --blue-800: #13116E;  --blue-700: #1B198F;
  --blue-600: #2724AE;  --blue-400: #4D49D8;  --blue-300: #7A77E4;
  --blue-100: #D8D7F8;  --blue-50:  #EEEEFB;
  --amber-600:#B87714;  --amber-500:#DB901B;  --amber-400:#E4A32E; --amber-50:#FEF9EF;
  --rose-300: #F1B8B3;  --rose-50:  #FEF5F4;
  --greige-950:#1E1B1B; --greige-900:#302D2D; --greige-800:#4C4747; --greige-700:#716B6A;
  --greige-600:#968F8E; --greige-500:#B5ADAC; --greige-400:#CDC1C0; --greige-300:#DDD6D5;
  --greige-200:#EAE5E4; --greige-100:#F3F0EF; --greige-50:#FAF8F8;

  /* --- Semantische Ebene (light) --- */
  --bg: var(--greige-50);
  --surface: #ffffff;
  --surface-2: var(--greige-100);
  --surface-3: var(--greige-200);
  --border: var(--greige-300);
  --border-2: var(--greige-400);
  --text: var(--greige-900);
  --text-strong: var(--greige-950);
  --muted: var(--greige-700);
  --muted-2: var(--greige-600);
  --accent: var(--blue-700);
  --accent-hover: var(--blue-800);
  --accent-weak: var(--blue-50);
  --warm: var(--amber-500);
  --warm-ink: var(--amber-600);
  --warm-weak: var(--amber-50);
  --green: #1A6B3C;  --green-weak: #E8F7EE;
  --red: #C94B43;    --red-weak: #FEF5F4;
  --rose: var(--rose-300);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(30,27,27,.05), 0 6px 20px rgba(30,27,27,.05);
  --shadow-lg: 0 12px 40px rgba(30,27,27,.14);
  --focus: 0 0 0 3px rgba(27,25,143,.22);
  --font: 'Outfit', system-ui, -apple-system, sans-serif;

  --topbar-h: 60px;
  --bottomnav-h: 62px;
  --sidebar-w: 256px;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #141212;
  --surface: #1E1B1B;
  --surface-2: #262222;
  --surface-3: #302D2D;
  --border: #3A3636;
  --border-2: #4C4747;
  --text: #F1EFEE;
  --text-strong: #FAF8F8;
  --muted: #B5ADAC;
  --muted-2: #8F8888;
  --accent: #7C79E8;
  --accent-hover: #9794ee;
  --accent-weak: rgba(124,121,232,.16);
  --warm: var(--amber-400);
  --warm-ink: var(--amber-400);
  --warm-weak: rgba(219,144,27,.14);
  --green: #4FB37A;  --green-weak: rgba(26,107,60,.20);
  --red: #E8948D;    --red-weak: rgba(201,75,67,.18);
  --shadow: 0 1px 3px rgba(0,0,0,.30), 0 6px 20px rgba(0,0,0,.28);
  --shadow-lg: 0 16px 48px rgba(0,0,0,.5);
  --focus: 0 0 0 3px rgba(124,121,232,.32);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;  /* iOS bläht Text in Scroll-Bereichen sonst auf */
  text-size-adjust: 100%;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3, h4 { margin: 0 0 .4em; font-weight: 600; letter-spacing: -.018em; color: var(--text-strong); }
h1 { font-weight: 350; letter-spacing: -.028em; }
::selection { background: var(--accent-weak); }

/* Editorial-Hilfsklassen */
.overline {
  font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted-2);
}
.muted { color: var(--muted); }

/* --- Icons (Lucide) --- */
.lucide { width: 18px; height: 18px; stroke-width: 2; flex: 0 0 auto; vertical-align: -.18em; }
.ic-empty { width: 38px; height: 38px; stroke-width: 1.5; }

/* ============================================================
   Login — Split: Firmen-Gehirn-Panel + Formular
   ============================================================ */
.login-wrap { min-height: 100dvh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-hero {
  position: relative; overflow: hidden; color: #fff; padding: 56px 56px 48px;
  background: linear-gradient(150deg, var(--blue-800) 0%, var(--blue-700) 55%, var(--blue-600) 100%);
  display: flex; flex-direction: column; justify-content: space-between;
}
.login-hero .syn { position: absolute; inset: 0; opacity: .22; pointer-events: none; }
.login-hero .hero-mark { display: flex; align-items: center; gap: 11px; position: relative; }
.login-hero .hero-mark .logo {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: rgba(255,255,255,.14); color: #fff; backdrop-filter: blur(4px);
}
.login-hero .hero-mark .logo .lucide { width: 22px; height: 22px; }
.login-hero .hero-mark b { font-size: 18px; letter-spacing: -.01em; }
.login-hero .hero-copy { position: relative; max-width: 17ch; }
.login-hero .hero-copy h2 {
  color: #fff; font-weight: 300; font-size: clamp(2.2rem, 4vw, 3.4rem);
  line-height: 1.05; letter-spacing: -.03em; margin: 0 0 .35em;
}
.login-hero .hero-copy h2 em { font-style: normal; color: var(--amber-400); }
.login-hero .hero-copy p { color: rgba(255,255,255,.78); font-size: 15px; max-width: 34ch; }
.login-hero .hero-foot { position: relative; font-size: 12.5px; color: rgba(255,255,255,.6); letter-spacing: .02em; }

.login-form-wrap { display: grid; place-items: center; padding: 32px; }
.login-card { width: 100%; max-width: 360px; }
.login-card h1 { font-size: 24px; margin: 0 0 4px; }
.login-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 28px; }
.login-card .btn { width: 100%; margin-top: 6px; }
.login-card .hint { font-size: 12.5px; text-align: center; color: var(--muted-2); margin: 16px 0 0; }

@media (max-width: 768px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { padding: 28px 24px; min-height: 200px; }
  .login-hero .hero-copy h2 { font-size: 2rem; }
}

/* ============================================================
   App-Shell
   ============================================================ */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100dvh; }

.sidebar {
  background: var(--surface-2); border-right: 1px solid var(--border);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 3px;
  position: sticky; top: 0; height: 100dvh; overflow-y: auto; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 20px; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 9px; flex: 0 0 auto;
  background: var(--accent); color: #fff; display: grid; place-items: center;
}
.brand .logo .lucide { width: 20px; height: 20px; }
.brand .name { font-weight: 600; font-size: 17px; line-height: 1.05; letter-spacing: -.02em; color: var(--text-strong); }
.brand .name small { display: block; color: var(--muted); font-weight: 500; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }

.nav-item {
  position: relative; display: flex; align-items: center; gap: 11px; padding: 10px 12px;
  border-radius: var(--radius-sm); color: var(--muted); font-weight: 500; font-size: 14.5px;
  user-select: none; transition: background .14s, color .14s;
}
.nav-item .ic { color: var(--muted-2); transition: color .14s; }
.nav-item:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav-item:hover .ic { color: var(--text); }
.nav-item.active { color: var(--accent); background: var(--accent-weak); font-weight: 600; }
.nav-item.active .ic { color: var(--accent); }
.nav-item.active::before {
  content: ''; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px; border-radius: 0 3px 3px 0; background: var(--warm);
}
.nav-item .badge {
  margin-left: auto; background: var(--warm); color: var(--greige-950);
  font-size: 11px; min-width: 20px; height: 20px; border-radius: 10px;
  display: grid; place-items: center; padding: 0 6px; font-weight: 700;
}
.nav-sep { height: 1px; background: var(--border); margin: 12px 8px; }
.nav-foot { margin-top: auto; font-size: 12px; color: var(--muted); padding: 10px 8px 4px; line-height: 1.7; }
.nav-foot b { color: var(--text); }
.nav-foot a { cursor: pointer; font-weight: 600; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  height: var(--topbar-h); padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.topbar h2 { font-size: 13px; margin: 0; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-2); white-space: nowrap; }
.topbar .search { flex: 1; max-width: 440px; margin-left: auto; position: relative; }
.topbar .search .lucide { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted-2); pointer-events: none; }
.topbar .search input { width: 100%; padding-left: 36px; height: 38px; background: var(--surface); }
.topbar .right { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.topbar .search + .right { margin-left: 0; }
.icon-btn {
  width: 38px; height: 38px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: transparent; color: var(--muted); display: grid; place-items: center;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.userchip { display: flex; align-items: center; gap: 9px; color: var(--text); font-size: 13.5px; font-weight: 500; padding: 5px 6px; border-radius: var(--radius-sm); cursor: pointer; }
.userchip:hover { background: var(--surface-2); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent);
  color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 12px; flex: 0 0 auto;
  overflow: hidden;
}
.avatar img, .msg .bubble-ico img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.acct-avatar { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.acct-av-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.content { padding: 28px 24px 40px; max-width: 1120px; width: 100%; margin: 0 auto; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

/* Mobile-Navigation */
.bottom-nav { display: none; }
.nav-backdrop { display: none; }

/* ============================================================
   Formulare & Buttons
   ============================================================ */
input, textarea, select {
  font-family: inherit; font-size: 14.5px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-2); border-radius: var(--radius-sm); padding: 10px 12px;
  width: 100%; outline: none; transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: var(--focus); }
label { font-size: 12.5px; font-weight: 600; color: var(--muted); display: block; margin: 0 0 6px; letter-spacing: .01em; }
.field { margin-bottom: 16px; }
.row { display: flex; gap: 14px; }
.row > * { flex: 1; min-width: 0; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  background: var(--accent); color: #fff; border: 1px solid var(--accent);
  border-radius: var(--radius-sm); padding: 10px 17px; font-weight: 600; font-size: 14px;
  white-space: nowrap; transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
}
.btn .lucide { width: 17px; height: 17px; }
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { box-shadow: var(--focus); }
.btn.warm { background: var(--warm); border-color: var(--warm); color: var(--greige-950); }
.btn.warm:hover { background: var(--amber-600); border-color: var(--amber-600); color: #fff; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border-2); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.ghost { background: transparent; color: var(--muted); border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { padding: 7px 12px; font-size: 13px; }
.btn.success { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { background: var(--surface); color: var(--red); border-color: var(--border-2); }
.btn.danger:hover { background: var(--red-weak); border-color: var(--red); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ============================================================
   Karten / Layout
   ============================================================ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card h3 { font-size: 16px; }
.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 24px; gap: 14px; flex-wrap: wrap; }
.page-head h1 { font-size: clamp(1.7rem, 3vw, 2.1rem); margin: 0; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 4px; max-width: 60ch; }

.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); cursor: pointer; transition: border-color .15s, transform .12s;
}
.stat:hover { border-color: var(--border-2); transform: translateY(-2px); }
.stat .num { font-size: 40px; font-weight: 300; letter-spacing: -.04em; line-height: 1; color: var(--text-strong); }
.stat .lbl { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; margin-top: 12px; }
.stat.accent { background: var(--warm-weak); border-color: color-mix(in srgb, var(--warm) 35%, transparent); }
.stat.accent .num { color: var(--warm-ink); }

.list-item {
  display: flex; align-items: center; gap: 14px; padding: 15px 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; box-shadow: var(--shadow);
  transition: border-color .14s;
}
.list-item:hover { border-color: var(--border-2); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; color: var(--text-strong); }
.list-item .meta { color: var(--muted); font-size: 12.5px; margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.list-item .meta .lucide { width: 14px; height: 14px; vertical-align: -.15em; }
.clickable { cursor: pointer; }

.tag {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px; background: var(--surface-3); color: var(--muted);
  letter-spacing: .02em; text-transform: capitalize;
}
.tag.mail, .tag.event { background: var(--blue-50); color: var(--blue-700); }
.tag.task { background: var(--warm-weak); color: var(--amber-600); }
.tag.insight { background: var(--green-weak); color: var(--green); }
.tag.project { background: var(--rose-50); color: #A6382F; }
.tag.meeting { background: var(--blue-50); color: var(--blue-600); }
.tag.fachwissen { background: var(--surface-3); color: var(--text); }
.tag.office { background: var(--surface-3); color: var(--muted); }
.tag.high { background: var(--red-weak); color: var(--red); }
.tag.normal, .tag.low { background: var(--surface-3); color: var(--muted-2); }
:root[data-theme="dark"] .tag.mail, :root[data-theme="dark"] .tag.event,
:root[data-theme="dark"] .tag.meeting { color: var(--blue-300); }
.conf { font-size: 11.5px; color: var(--muted); }
.conf b { color: var(--text-strong); }

.empty { text-align: center; color: var(--muted); padding: 56px 20px; }
.empty .ic-empty { color: var(--border-2); margin-bottom: 10px; }
.empty b { display: block; color: var(--text-strong); font-size: 16px; margin-bottom: 4px; }

.banner {
  background: var(--accent-weak); border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
  border-radius: var(--radius); padding: 14px 16px; font-size: 13.5px; color: var(--text);
  margin-bottom: 20px; display: flex; gap: 12px; align-items: flex-start;
}
.banner .lucide { color: var(--accent); margin-top: 1px; }
.banner code, code { background: color-mix(in srgb, var(--text) 8%, transparent); padding: 2px 7px; border-radius: 5px; font-size: 12.5px; font-family: ui-monospace, monospace; }

.kv { display: grid; grid-template-columns: 100px 1fr; gap: 6px 14px; font-size: 13.5px; margin-bottom: 16px; }
.kv .k { color: var(--muted); font-weight: 500; }

/* ============================================================
   Chat
   ============================================================ */
.chat-wrap { display: flex; flex-direction: column; height: calc(100dvh - var(--topbar-h)); }
.chat-head { display: flex; justify-content: flex-end; padding: 10px 24px 0; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 18px 24px 28px; }
.chat-inner { max-width: 760px; margin: 0 auto; }
.msg { display: flex; gap: 14px; margin-bottom: 24px; }
.msg .bubble-ico { width: 32px; height: 32px; border-radius: 9px; flex: 0 0 auto; display: grid; place-items: center; font-weight: 600; font-size: 12px; overflow: hidden; }
.msg .bubble-ico .lucide { width: 18px; height: 18px; }
.msg.user .bubble-ico { background: var(--surface-3); color: var(--muted); }
.msg.assistant .bubble-ico { background: var(--accent); color: #fff; }
.msg .body { flex: 1; min-width: 0; padding-top: 4px; }
.msg .body p { margin: 0 0 .6em; }
.msg .body h1, .msg .body h2, .msg .body h3 { font-size: 1.05em; margin: .6em 0 .3em; }
.msg .body blockquote { margin: .5em 0; padding: 8px 14px; border-left: 3px solid var(--warm); color: var(--muted); background: var(--surface-2); border-radius: 6px; }
.msg .body ul { margin: .4em 0; padding-left: 1.2em; }
.sources { margin-top: 12px; display: flex; flex-direction: column; gap: 7px; }
.source-chip { font-size: 12.5px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; cursor: pointer; transition: border-color .14s; }
.source-chip:hover { border-color: var(--accent); }
.source-chip .s-title { font-weight: 600; }
.msg-actions { margin-top: 10px; }
.chat-input { border-top: 1px solid var(--border); padding: 16px 24px; background: var(--surface); }
.chat-input .inner { max-width: 760px; margin: 0 auto; }
.chat-input textarea { resize: none; max-height: 140px; }
.suggest { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.suggest .chip { font-size: 13px; padding: 7px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 20px; cursor: pointer; color: var(--muted); transition: color .14s, border-color .14s; }
.suggest .chip:hover { color: var(--accent); border-color: var(--accent); }

/* ============================================================
   Drawer / Kommentare
   ============================================================ */
.drawer-overlay { position: fixed; inset: 0; background: rgba(20,18,18,.4); z-index: 40; opacity: 0; transition: opacity .2s; }
.drawer-overlay.show { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100dvh; width: 500px; max-width: 94vw; background: var(--bg);
  border-left: 1px solid var(--border); z-index: 41; box-shadow: var(--shadow-lg);
  transform: translateX(100%); transition: transform .26s cubic-bezier(.4,0,.2,1); display: flex; flex-direction: column;
}
.drawer.show { transform: translateX(0); }
.drawer-head { display: flex; align-items: flex-start; gap: 10px; padding: 20px 22px; border-bottom: 1px solid var(--border); }
.drawer-head h3 { margin: 0; font-size: 19px; }
.drawer-head .close { margin-left: auto; }
.drawer-body { flex: 1; overflow-y: auto; padding: 22px; }
.md-body { font-size: 14px; line-height: 1.7; }
.md-body p { margin: 0 0 .7em; }
.md-body h1, .md-body h2, .md-body h3 { margin: .8em 0 .35em; }

.comments { margin-top: 24px; border-top: 1px solid var(--border); padding-top: 18px; }
.comments h4 { font-size: 11px; color: var(--muted-2); text-transform: uppercase; letter-spacing: .1em; font-weight: 600; }
.comment { display: flex; gap: 11px; margin-bottom: 14px; }
.comment .c-body { background: var(--surface); border: 1px solid var(--border); border-radius: 11px; padding: 10px 13px; flex: 1; font-size: 13.5px; }
.comment .c-head { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.comment .c-head b { color: var(--text-strong); }
.comment-form { display: flex; gap: 8px; margin-top: 12px; }
.comment-form input { flex: 1; }
.file-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; cursor: pointer; color: var(--accent); }
.file-link:hover { text-decoration: underline; }
.file-link .ic { width: 14px; height: 14px; }
.file-preview { width: 100%; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); margin: 4px 0; }
iframe.file-preview { height: 65vh; }
img.file-preview { height: auto; max-height: 65vh; object-fit: contain; display: block; }

/* ============================================================
   Agenda / Aufgaben / Dateien
   ============================================================ */
.agenda-day { margin-bottom: 22px; }
.agenda-day .daylabel { font-size: 11px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 10px; }
.event-row { border-left: 3px solid var(--accent); }
.task-check { width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--border-2); background: var(--surface); flex: 0 0 auto; cursor: pointer; display: grid; place-items: center; color: #fff; transition: background .14s, border-color .14s; }
.task-check .lucide { width: 14px; height: 14px; opacity: 0; }
.task-check.done { background: var(--green); border-color: var(--green); }
.task-check.done .lucide { opacity: 1; }
.done .title { text-decoration: line-through; color: var(--muted); }

.breadcrumb { display: flex; gap: 7px; align-items: center; font-size: 13.5px; color: var(--muted); margin-bottom: 18px; flex-wrap: wrap; }
.breadcrumb a { cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.file-ico { width: 34px; height: 34px; border-radius: 9px; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); flex: 0 0 auto; }
.file-ico .lucide { width: 18px; height: 18px; }

.spinner { width: 28px; height: 28px; border: 3px solid var(--border-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; margin: 56px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Toasts
   ============================================================ */
#toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--text-strong); color: var(--bg); padding: 11px 20px; border-radius: 22px; font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-lg); animation: pop .2s; }
.toast.err { background: var(--red); color: #fff; }
@keyframes pop { from { opacity: 0; transform: translateY(10px); } }

/* ============================================================
   Responsive — Tablet & Smartphone
   ============================================================ */
@media (max-width: 980px) {
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  :root { --sidebar-w: 0px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; width: 280px; max-width: 84vw; height: 100dvh;
    transform: translateX(-100%); transition: transform .24s cubic-bezier(.4,0,.2,1);
    box-shadow: var(--shadow-lg); border-right: 1px solid var(--border);
  }
  .sidebar.open { transform: translateX(0); }
  .nav-backdrop { display: block; position: fixed; inset: 0; background: rgba(20,18,18,.4); z-index: 25; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .nav-backdrop.show { opacity: 1; pointer-events: auto; }

  .topbar .search { display: none; }
  .topbar h2 { margin-right: auto; }

  .content { padding: 22px 18px calc(var(--bottomnav-h) + 28px); }
  .chat-wrap { height: calc(100dvh - var(--topbar-h) - var(--bottomnav-h)); }
  .chat-scroll, .chat-input { padding-left: 18px; padding-right: 18px; }
  /* iOS zoomt beim Fokus, wenn Felder < 16px sind → verhindert das Wegspringen. */
  input, textarea, select { font-size: 16px; }

  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 24;
    height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
  }
  .bn-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--muted-2); font-size: 10px; font-weight: 600; letter-spacing: .02em; position: relative; background: none; border: 0;
  }
  .bn-item .lucide { width: 21px; height: 21px; }
  .bn-item.active { color: var(--accent); }
  .bn-item .badge { position: absolute; top: 7px; left: 50%; margin-left: 5px; background: var(--warm); color: var(--greige-950); font-size: 10px; min-width: 16px; height: 16px; border-radius: 8px; display: grid; place-items: center; padding: 0 4px; font-weight: 700; }
}
@media (max-width: 560px) {
  .grid.cols-4, .grid.cols-2 { grid-template-columns: 1fr; }
  .page-head { align-items: flex-start; }
  .drawer { width: 100vw; max-width: 100vw; }
  .row { flex-direction: column; gap: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------------- Kalender (FullCalendar #14) ---------------- */
.cal-tools { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.cal-dd { position: relative; }
.cal-dd > summary { list-style: none; cursor: pointer; }
.cal-dd > summary::-webkit-details-marker { display: none; }
.cal-dd-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 210px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.14); max-height: 70vh; overflow: auto;
}
.cal-abo .cal-dd-panel { width: min(420px, calc(100vw - 32px)); }
.cal-chk { display: flex; align-items: center; gap: 9px; padding: 7px 8px; font-size: 14px; cursor: pointer; border-radius: var(--radius-sm); }
.cal-chk:hover { background: var(--surface-2); }
.cal-chk input { accent-color: var(--accent); width: 15px; height: 15px; }
.cal-dot { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.cal-abo-name { display: flex; align-items: center; gap: 9px; padding: 7px 8px 4px; font-size: 14px; font-weight: 600; }
.cal-entry { padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.cal-entry + .cal-entry { padding-top: 6px; }
.cal-url-row { display: grid; grid-template-columns: 82px 1fr; gap: 8px; align-items: center; padding: 3px 8px; font-size: 12px; }
.cal-url-row > div { display: flex; gap: 4px; min-width: 0; }
.cal-url-row input { min-width: 0; width: 100%; padding: 5px 7px; font-size: 11px; }
.cal-url-row .icon-btn { width: 28px; height: 28px; flex: none; }
.cal-help { padding: 8px; font-size: 12px; }
.cal-help summary { cursor: pointer; font-weight: 600; }
.cal-help p { margin: 7px 0 0; color: var(--muted); line-height: 1.4; }
.cal-grid {
  --fc-border-color: var(--border);
  --fc-page-bg-color: var(--surface);
  --fc-neutral-bg-color: var(--surface-2);
  --fc-today-bg-color: var(--accent-weak);
  --fc-button-bg-color: var(--surface-2);
  --fc-button-border-color: var(--border);
  --fc-button-text-color: var(--text);
  --fc-button-hover-bg-color: var(--surface-3);
  --fc-button-hover-border-color: var(--border-2);
  --fc-button-active-bg-color: var(--accent);
  --fc-button-active-border-color: var(--accent);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px;
}
.cal-grid .fc { font-family: inherit; }
.cal-grid .fc .fc-toolbar-title { font-size: 18px; font-weight: 600; color: var(--text-strong); }
.cal-grid .fc .fc-button { font-weight: 500; text-transform: capitalize; box-shadow: none; }
.cal-grid .fc .fc-button-active { color: #fff; }
.cal-grid .fc .fc-col-header-cell-cushion,
.cal-grid .fc .fc-daygrid-day-number,
.cal-grid .fc .fc-timegrid-axis-cushion,
.cal-grid .fc .fc-timegrid-slot-label-cushion { color: var(--muted); text-decoration: none; }
.cal-grid .fc .fc-week-number, .cal-grid .fc .fc-daygrid-week-number { color: var(--muted-2); background: var(--surface-2); }
.cal-grid .fc-event { border: none; font-weight: 500; padding: 1px 4px; cursor: pointer; }
@media (max-width: 560px) {
  .cal-grid .fc-toolbar.fc-header-toolbar { flex-direction: column; gap: 8px; }
}

/* ---------------- Benutzerfarben (#19) ---------------- */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; outline: none; box-shadow: 0 0 0 1px var(--border) inset; }
.swatch.on { border-color: var(--text-strong); box-shadow: 0 0 0 2px var(--surface) inset; }
.assignee-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; vertical-align: middle; flex: none; }
