/* Milli – helles Tech-Design. Schriften selbst gehostet (kein Google-Fonts-Abruf). */

@font-face {
  font-family: "Inter";
  src: url("/static/fonts/inter.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/static/fonts/jetbrains-mono.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --grid: rgba(15, 23, 42, 0.045);
  --text: #0b1220;
  --text-2: #344054;
  --muted: #667085;
  --faint: #98a2b3;
  --accent: #059669;
  --accent-2: #2563eb;
  --accent-soft: #ecfdf5;
  --accent-line: #a7f3d0;
  --warn: #b54708;
  --warn-soft: #fffaeb;
  --warn-line: #fedf89;
  --danger: #d92d20;
  --danger-soft: #fef3f2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px -12px rgba(16, 24, 40, .18), 0 2px 6px rgba(16, 24, 40, .06);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

/* Feines Raster + farbiger Schimmer oben */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -2;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse 85% 55% at 50% 0%, #000 35%, transparent 80%);
}
body::after {
  content: "";
  position: fixed; z-index: -1; pointer-events: none;
  width: 1000px; height: 520px; left: 50%; top: -300px; transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(16, 185, 129, .16), rgba(37, 99, 235, .10) 55%, transparent);
  filter: blur(30px);
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { color: #1d4ed8; }
h1 { font-size: 1.7rem; font-weight: 700; letter-spacing: -.025em; margin: 0 0 1.25rem; }
h2 { font: 600 .74rem/1 var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 2rem 0 .85rem; display: flex; align-items: center; gap: .55rem; }
code, .mono { font-family: var(--mono); font-size: .9em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .84rem; }
::selection { background: #bbf7d0; }

/* ---------- App-Rahmen ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 1.25rem; padding: 1.25rem .9rem;
  background: rgba(255, 255, 255, .82); backdrop-filter: blur(14px);
  border-right: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: .6rem; padding: .25rem .5rem; color: var(--text); font-weight: 700; letter-spacing: -.01em; }
.logo:hover { color: var(--text); }
.logo-mark {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, #10b981, #2563eb); color: #fff; font: 700 15px/1 var(--mono);
  box-shadow: 0 6px 18px -6px rgba(37, 99, 235, .55);
}
.logo small { display: block; font: 500 .66rem/1.2 var(--mono); color: var(--faint); letter-spacing: .08em; text-transform: uppercase; }

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav .label { font: 600 .64rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--faint); padding: .95rem .6rem .45rem; }
.side-nav a, .side-nav .soon {
  display: flex; align-items: center; gap: .65rem; padding: .5rem .6rem; border-radius: 9px;
  color: var(--text-2); font-size: .92rem; border: 1px solid transparent; transition: background .15s, color .15s;
}
.side-nav a:hover { color: var(--text); background: var(--surface-2); }
.side-nav a.active { color: var(--text); background: var(--surface); border-color: var(--line); box-shadow: var(--shadow); font-weight: 600; }
.side-nav a.active svg { color: var(--accent); }
.side-nav .soon { opacity: .45; cursor: default; }
.side-nav .soon::after { content: "bald"; margin-left: auto; font: 500 .6rem/1 var(--mono); text-transform: uppercase; letter-spacing: .08em; border: 1px solid var(--line-strong); border-radius: 99px; padding: .2rem .4rem; }
.side-nav svg, .icon { width: 18px; height: 18px; flex: none; }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: .6rem; }
.status-line { display: flex; align-items: center; gap: .45rem; font: 500 .7rem/1 var(--mono); color: var(--faint); padding: 0 .6rem; letter-spacing: .04em; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, .18); animation: pulse 2.4s ease-in-out infinite; flex: none; }
.dot.warn { background: #f79009; box-shadow: 0 0 0 3px rgba(247, 144, 9, .18); }
@keyframes pulse { 50% { opacity: .45; } }
.user-chip { display: flex; align-items: center; gap: .6rem; padding: .55rem .6rem; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #d1fae5, #dbeafe); color: #065f46; font: 700 .78rem/1 var(--mono); flex: none; }
.user-chip .who { min-width: 0; flex: 1; font-size: .82rem; line-height: 1.25; font-weight: 600; }
.user-chip .who span { display: block; color: var(--faint); font-size: .72rem; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: .3rem; border-radius: 6px; display: grid; place-items: center; }
.icon-btn:hover { color: var(--text); background: var(--surface-2); }

main { padding: 2rem clamp(16px, 4vw, 3rem) 4rem; max-width: 1280px; width: 100%; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-head h1 { margin: 0; }
.crumbs { font: 500 .7rem/1 var(--mono); color: var(--faint); letter-spacing: .08em; margin-bottom: .55rem; text-transform: uppercase; }
.crumbs a { color: var(--muted); }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; z-index: 10; height: auto; flex-direction: row; align-items: center; gap: .5rem; padding: .6rem 16px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .logo small, .side-nav .label, .side-foot .status-line, .user-chip .who, .side-nav .soon { display: none; }
  .side-nav { flex-direction: row; gap: 2px; }
  .side-nav a { padding: .45rem .55rem; font-size: .85rem; white-space: nowrap; }
  .side-foot { margin: 0 0 0 auto; flex-direction: row; }
  .user-chip { padding: .3rem; border: 0; background: none; box-shadow: none; }
  main { padding-top: 1.25rem; }
}

/* ---------- Bausteine ---------- */
.card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); }
a.card { color: inherit; display: block; transition: border-color .2s, transform .2s, box-shadow .2s; }
a.card:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: var(--shadow-lg); color: inherit; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: .85rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .55rem .95rem; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font: 600 .9rem/1.2 var(--sans); cursor: pointer;
  box-shadow: var(--shadow); transition: border-color .15s, background .15s, box-shadow .15s, transform .15s;
}
.btn:hover { color: var(--text); background: var(--surface-2); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn.primary { border-color: transparent; color: #fff; background: linear-gradient(135deg, #059669, #0d9488 45%, #2563eb); box-shadow: 0 8px 22px -10px rgba(37, 99, 235, .6); }
.btn.primary:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 12px 28px -10px rgba(37, 99, 235, .65); }
.btn.danger { color: var(--danger); border-color: #fecdca; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: none; box-shadow: none; color: var(--muted); }
.btn.sm { padding: .35rem .65rem; font-size: .8rem; border-radius: 8px; }
.btn .icon { width: 16px; height: 16px; }

.badge {
  display: inline-flex; align-items: center; gap: .3rem; padding: .14rem .5rem; border-radius: 99px;
  font: 600 .66rem/1.35 var(--mono); letter-spacing: .04em; text-transform: uppercase;
  background: var(--accent-soft); color: #047857; border: 1px solid var(--accent-line); vertical-align: middle;
}
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.badge.neutral { background: var(--surface-2); color: var(--muted); border-color: var(--line); }

.notice { padding: .75rem 1rem; border-radius: 10px; background: var(--accent-soft); color: #047857; border: 1px solid var(--accent-line); margin-bottom: 1rem; font-size: .9rem; }
.notice.error { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }

/* Kennzahlen */
.stats { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
.stat { padding: 1rem 1.1rem; }
.stat .k { font: 600 .66rem/1 var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); display: flex; align-items: center; gap: .45rem; }
.stat .k .icon { width: 14px; height: 14px; color: var(--accent); }
.stat .v { font: 700 2rem/1.1 var(--mono); letter-spacing: -.04em; margin-top: .7rem; }
.stat .s { font-size: .78rem; color: var(--faint); margin-top: .3rem; }
.stat.warn .v { color: #dc6803; }
@media (max-width: 640px) { .stats { gap: .6rem; } .stat .v { font-size: 1.6rem; } }

/* Formulare */
form.stack label, .field label, label.lbl { display: block; font: 600 .68rem/1 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: .45rem; }
input, select, textarea {
  width: 100%; padding: .6rem .75rem; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); color: var(--text); font: inherit; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #34d399; box-shadow: 0 0 0 4px rgba(16, 185, 129, .15); }
input[type="file"] { padding: .5rem; background: var(--surface-2); }
input[type="checkbox"] { width: auto; accent-color: var(--accent); }
textarea { min-height: 5.5rem; resize: vertical; }
.two { display: grid; gap: .85rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) { .two { grid-template-columns: 1fr; } }

/* Ablage */
.layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 1rem; align-items: start; }
.layout > * { min-width: 0; }
@media (max-width: 960px) { .layout { grid-template-columns: 1fr !important; } }
.folders { list-style: none; margin: 0; padding: .35rem; }
.folders a { display: flex; justify-content: space-between; gap: .5rem; padding: .48rem .65rem; border-radius: 8px; color: var(--text-2); font-size: .9rem; }
.folders a span:last-child { font: 500 .75rem/1.6 var(--mono); color: var(--faint); }
.folders a:hover { color: var(--text); background: var(--surface-2); }
.folders a.active { color: #047857; background: var(--accent-soft); font-weight: 600; }
.folders a.active span:last-child { color: var(--accent); }

/* Tabellen */
.docs { width: 100%; border-collapse: collapse; }
.docs th { text-align: left; font: 600 .66rem/1 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--faint); padding: .4rem .6rem .7rem; border-bottom: 1px solid var(--line); }
.docs td { padding: .7rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.docs tr:last-child td { border-bottom: 0; }
.docs tr:hover td { background: #fafbfc; }
.docs td a { color: var(--text); font-weight: 600; }
.docs td a:hover { color: var(--accent-2); }
.docs .date { font: 400 .8rem/1.5 var(--mono); color: var(--muted); white-space: nowrap; text-align: right; }
.docs .acct { font-size: .78rem; color: var(--faint); white-space: nowrap; }
@media (max-width: 640px) { .docs .hide-sm { display: none; } }

.preview { width: 100%; height: 75vh; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
img.preview { height: auto; max-height: 75vh; object-fit: contain; }
.mail-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.7; color: var(--text-2); }

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty .icon { width: 28px; height: 28px; color: var(--faint); margin-bottom: .6rem; }

/* ---------- Projekte & Mail-Kacheln ---------- */
.p-emerald { --p: #10b981; --p-soft: #ecfdf5; --p-ink: #047857; }
.p-blue    { --p: #3b82f6; --p-soft: #eff6ff; --p-ink: #1d4ed8; }
.p-violet  { --p: #8b5cf6; --p-soft: #f5f3ff; --p-ink: #6d28d9; }
.p-amber   { --p: #f59e0b; --p-soft: #fffbeb; --p-ink: #b45309; }
.p-rose    { --p: #f43f5e; --p-soft: #fff1f2; --p-ink: #be123c; }
.p-cyan    { --p: #06b6d4; --p-soft: #ecfeff; --p-ink: #0e7490; }
.p-slate   { --p: #64748b; --p-soft: #f1f5f9; --p-ink: #334155; }
.p-none    { --p: #98a2b3; --p-soft: #f2f4f7; --p-ink: #475467; }

.pdot { width: 10px; height: 10px; border-radius: 3px; background: var(--p); flex: none; }
.ptag { display: inline-flex; align-items: center; gap: .35rem; padding: .16rem .55rem; border-radius: 99px; background: var(--p-soft); color: var(--p-ink); font: 600 .72rem/1.35 var(--sans); }
.ptag::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--p); }

.group { margin-top: 1.6rem; }
.group-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .75rem; }
.group-head .name { font-weight: 700; font-size: 1rem; letter-spacing: -.01em; color: var(--text); }
.group-head .count { white-space: nowrap; font: 600 .7rem/1 var(--mono); color: var(--p-ink); background: var(--p-soft); padding: .25rem .5rem; border-radius: 99px; }
.group-head a.more { margin-left: auto; font-size: .82rem; white-space: nowrap; }

.tiles { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.tile {
  position: relative; display: flex; flex-direction: column; gap: .55rem; min-height: 210px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1rem .85rem;
  box-shadow: var(--shadow); transition: box-shadow .2s, transform .2s, border-color .2s; overflow: hidden;
}
.tile::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 3px; background: var(--p); }
.tile:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: var(--line-strong); }
.tile .who { display: flex; align-items: center; gap: .55rem; min-width: 0; }
.tile .who .avatar { width: 28px; height: 28px; font-size: .72rem; background: var(--p-soft); color: var(--p-ink); }
.tile .who .n { font-weight: 600; font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.tile .who .t { font: 500 .7rem/1 var(--mono); color: var(--faint); white-space: nowrap; }
.tile .subj { font-weight: 650; font-size: .95rem; line-height: 1.35; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .subj:hover { color: var(--accent-2); }
.tile .snip { font-size: .83rem; color: var(--muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tile .foot { margin-top: auto; display: flex; align-items: center; gap: .5rem; padding-top: .6rem; border-top: 1px dashed var(--line); }
.tile .foot form { flex: 1; display: flex; gap: .4rem; min-width: 0; }
.tile .foot select { padding: .35rem .5rem; font-size: .8rem; border-radius: 8px; background: var(--surface-2); border-color: var(--line); }
.tile .foot input { padding: .35rem .5rem; font-size: .8rem; border-radius: 8px; }
.tile .meta { display: flex; gap: .35rem; flex-wrap: wrap; }

/* ---------- Login ---------- */
.gate { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr auto; padding: 1.25rem clamp(16px, 4vw, 2.5rem); }
.gate-top { display: flex; justify-content: space-between; align-items: center; font: 500 .72rem/1 var(--mono); color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.gate-top .logo { font: 700 .95rem/1 var(--sans); letter-spacing: -.01em; text-transform: none; }
.gate-top .row { gap: .5rem; }
.gate-center { display: grid; grid-template-columns: minmax(0, 460px); justify-content: center; align-content: center; padding: 3rem 0; }
.gate-kicker { font: 600 .74rem/1 var(--mono); color: var(--accent); letter-spacing: .14em; text-transform: uppercase; display: flex; align-items: center; gap: .5rem; }
.gate-kicker::before { content: ""; width: 24px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, #10b981, #2563eb); }
.hello {
  font-size: clamp(3rem, 11vw, 5.2rem); font-weight: 800; letter-spacing: -.05em; line-height: 1;
  margin: 1.1rem 0 1rem;
  background: linear-gradient(120deg, #0b1220 25%, #065f46 60%, #1d4ed8);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hello .cursor { display: inline-block; width: .085em; height: .8em; margin-left: .06em; vertical-align: -.04em; border-radius: 2px; background: linear-gradient(180deg, #10b981, #2563eb); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.gate-sub { color: var(--muted); font-size: 1.05rem; margin: 0 0 2rem; max-width: 32ch; }
.gate-panel { padding: 1.1rem; display: flex; flex-direction: column; gap: .75rem; box-shadow: var(--shadow-lg); }
.btn.google { width: 100%; padding: .8rem 1rem; font-size: .98rem; }
.btn.google svg { width: 18px; height: 18px; }
.gate-meta { display: flex; justify-content: space-between; font: 400 .7rem/1.4 var(--mono); color: var(--faint); letter-spacing: .04em; }
.gate-foot { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font: 400 .7rem/1 var(--mono); color: var(--faint); letter-spacing: .06em; }
.term { font: 400 .78rem/1.8 var(--mono); color: var(--muted); margin-top: 1.5rem; }
.term .ok { color: var(--accent); font-weight: 700; }
