/* Clelio intern: Papier, Tinte, Signalrot für Fristen. Hell als Standard, dunkel nach Systemeinstellung. */
@font-face {
  font-family: "CB Garamond";
  src: url("../fonts/eb-garamond-variable.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
}
@font-face {
  font-family: "CB Manrope";
  src: url("../fonts/manrope-latin-wght-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --paper: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --ink: #161b22;
  --muted: #5c6573;
  --line: #dde2e8;
  --accent: #1f3a5f;
  --accent-ink: #ffffff;
  --accent-soft: rgba(31, 58, 95, 0.09);
  --signal: #c3161c;
  --signal-soft: rgba(195, 22, 28, 0.09);
  --ok: #1c7a4d;
  --warn: #9a5800;
  --info: #1f5fa8;
  --display: "CB Garamond", Georgia, "Times New Roman", serif;
  --body: "CB Manrope", "Avenir Next", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 8px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e1217;
    --surface: #161c24;
    --surface-2: #1d2530;
    --ink: #e6eaf0;
    --muted: #9aa5b3;
    --line: #2a333f;
    --accent: #9cbcea;
    --accent-ink: #0e1217;
    --accent-soft: rgba(156, 188, 234, 0.12);
    --signal: #ff6a6a;
    --signal-soft: rgba(255, 106, 106, 0.13);
    --ok: #5ad39a;
    --warn: #f2c14e;
    --info: #8fb8ff;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.55; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.2; margin: 0 0 0.5em; text-wrap: balance; }
h1 { font-size: clamp(1.9rem, 3vw, 2.5rem); letter-spacing: -0.01em; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.02rem; font-family: var(--body); font-weight: 700; margin-top: 1.1em; }
p { margin: 0 0 0.8em; }
small, .small { font-size: 0.86rem; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 0.88em; overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Layout */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 1.1rem;
  padding: 1.3rem 1rem; background: var(--surface); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 0.65rem; color: var(--ink); text-decoration: none; }
.brand strong { display: block; font-family: var(--display); font-size: 1.2rem; line-height: 1.1; }
.brand small { color: var(--muted); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.7rem; }
.brand-mark {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 6px; flex: none;
  background: var(--ink); color: var(--paper); font-family: var(--display); font-weight: 700; font-size: 0.95rem; letter-spacing: 0.02em;
}
.brand-mark-large { width: 48px; height: 48px; font-size: 1.25rem; margin-bottom: 0.6rem; }
.nav { display: flex; flex-direction: column; gap: 0.1rem; flex: 1; }
.nav a { display: flex; justify-content: space-between; align-items: center; padding: 0.42rem 0.65rem; border-radius: 6px; color: var(--muted); text-decoration: none; font-weight: 600; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active { background: var(--accent-soft); color: var(--ink); box-shadow: inset 2px 0 0 var(--accent); }
.nav-group { margin-top: 0.9rem; display: flex; flex-direction: column; gap: 0.1rem; }
.nav-label { display: block; padding: 0 0.65rem 0.2rem; font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.count { display: inline-block; min-width: 1.5em; padding: 0 0.4em; border-radius: 999px; background: var(--surface-2); font-size: 0.75rem; text-align: center; color: var(--muted); font-weight: 700; }
.count-hot { background: var(--signal); color: #fff; }
.sidebar-foot { border-top: 1px solid var(--line); padding-top: 0.85rem; display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.me { font-weight: 700; }
.me small { display: block; color: var(--muted); font-weight: 500; }
.main { min-width: 0; }
.topbar { display: none; }
.content { max-width: 1240px; margin: 0 auto; padding: 1.8rem 2rem 4rem; }
.wide .content { max-width: none; }
.solo { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }

/* Page elements */
.page-head { margin-bottom: 1.4rem; }
.eyebrow { margin: 0 0 0.3rem; color: var(--muted); font-weight: 700; font-size: 0.76rem; letter-spacing: 0.12em; text-transform: uppercase; }
.eyebrow a { color: inherit; text-decoration: none; }
.eyebrow a:hover { color: var(--ink); }
.lede { color: var(--muted); font-size: 1.02rem; max-width: 72ch; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem 1.25rem; margin-bottom: 1.1rem; }
.panel-highlight { border-color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }
.panel.narrow, .narrow { max-width: 720px; }
.is-muted { opacity: 0.6; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; align-items: start; }
.two-col.wide-left { grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); }
.two-col > * { min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem 1rem; }
.row { display: flex; gap: 0.7rem; flex-wrap: wrap; align-items: flex-end; }
.row > label { flex: 1 1 160px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.row-between h2 { margin: 0; }
.toolbar { margin-bottom: 0.8rem; }
.stack-sm { margin: 0.4rem 0; }

/* Flash and notes */
.flash { padding: 0.7rem 1rem; border-radius: 6px; margin-bottom: 1rem; border: 1px solid var(--line); background: var(--surface); border-left-width: 4px; }
.flash-success { border-left-color: var(--ok); }
.flash-error { border-left-color: var(--signal); }
.flash-info { border-left-color: var(--info); }
.note { margin: 0.6rem 0 1rem; padding: 0.65rem 0.9rem; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 4px; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 0.8rem; }
label { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 600; font-size: 0.9rem; }
label.inline { flex-direction: row; align-items: center; gap: 0.5rem; }
label.check { flex-direction: row; align-items: center; gap: 0.5rem; font-weight: 500; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 0.5rem 0.65rem; width: 100%; }
input[type="checkbox"] { width: auto; accent-color: var(--accent); }
input[readonly], textarea[readonly] { opacity: 0.75; }
textarea { resize: vertical; min-height: 4rem; }
.mail-editor { font-family: var(--body); line-height: 1.6; min-height: 22rem; }
.mono-area { font-family: var(--mono); font-size: 0.85rem; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.inline-form { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.inline-form select { width: auto; }
.actions-row { display: flex; gap: 0.7rem; flex-wrap: wrap; align-items: center; }
.sticky-actions { position: sticky; bottom: 0; padding: 0.7rem 0; background: linear-gradient(transparent, var(--surface) 30%); }
.copy-field { display: flex; gap: 0.5rem; margin: 0.5rem 0 0.8rem; }
.copy-field input { font-family: var(--mono); font-size: 0.82rem; }

/* Buttons */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; padding: 0.55rem 1rem; border-radius: 6px; border: 1px solid transparent; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap; }
.button-primary { background: var(--accent); color: var(--accent-ink); }
.button-primary:hover { filter: brightness(1.1); }
.button-secondary { background: transparent; color: var(--ink); border-color: var(--line); }
.button-secondary:hover { border-color: var(--accent); }
.button[disabled] { opacity: 0.45; cursor: not-allowed; }
.button-wide { width: 100%; }
.link-button { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 0.2rem 0; text-decoration: underline; text-underline-offset: 3px; }
.link-button.danger { color: var(--signal); }
.chip { display: inline-flex; align-items: center; padding: 0.28rem 0.7rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: inherit; font-size: 0.84rem; font-weight: 700; cursor: pointer; text-decoration: none; }
.chip:hover { color: var(--ink); border-color: var(--accent); }
.chip-active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.filter-row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.status-buttons { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 1.1rem; }

/* Badges */
.badge { display: inline-block; padding: 0.08rem 0.5rem; border-radius: 999px; font-size: 0.74rem; font-weight: 700; border: 1px solid var(--line); color: var(--muted); vertical-align: middle; white-space: nowrap; }
.badge-ok { color: var(--ok); border-color: currentColor; }
.badge-warn { color: var(--warn); border-color: currentColor; }
.badge-danger { color: var(--signal); border-color: currentColor; background: var(--signal-soft); }
.badge-info { color: var(--info); border-color: currentColor; }
.badge-muted { opacity: 0.7; }
.overdue { color: var(--signal); font-weight: 700; }

/* KPIs and lists */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.7rem; margin-bottom: 1.1rem; }
.kpis div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.8rem 0.95rem; }
.kpis span { display: block; color: var(--muted); font-size: 0.8rem; }
.kpis strong { font-family: var(--display); font-size: 1.8rem; font-variant-numeric: tabular-nums; }
.card-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.1rem 0.8rem; padding: 0.6rem 0; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.card-line:last-child { border-bottom: 0; }
.card-line strong { grid-column: 1; }
.card-line span { grid-column: 1; color: var(--muted); font-size: 0.86rem; }
.card-line .badge { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.card-line:hover strong { color: var(--accent); }
.activity, .link-list, .file-list, .people { list-style: none; margin: 0; padding: 0; }
.activity li, .file-list li, .people li { padding: 0.5rem 0; border-bottom: 1px solid var(--line); }
.activity li:last-child, .file-list li:last-child, .people li:last-child { border-bottom: 0; }
.activity small, .file-list small, .people small { display: block; color: var(--muted); }
.link-list li { padding: 0.25rem 0; }
.link-list a.active { color: var(--ink); font-weight: 700; }
.file-list li { display: flex; flex-wrap: wrap; gap: 0.2rem 0.8rem; align-items: baseline; }
.file-list li small { flex-basis: 100%; }
.stats { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.35rem 1rem; margin: 0 0 0.9rem; }
.stats dt { color: var(--muted); font-size: 0.86rem; }
.stats dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

/* Board */
.board-tools { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.new-card { flex: 1 1 520px; max-width: 760px; }
.new-card summary { list-style: none; float: right; }
.new-card summary::-webkit-details-marker { display: none; }
.new-card[open] summary { margin-bottom: 0.6rem; }
.new-card .panel { clear: both; }
.board { display: grid; grid-template-columns: repeat(8, minmax(220px, 1fr)); gap: 0.7rem; margin-bottom: 1.2rem; overflow-x: auto; padding-bottom: 0.5rem; }
.board-column { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.7rem; min-height: 220px; display: flex; flex-direction: column; }
.board-column h2 { font-family: var(--body); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.column-rueckfrage h2, .column-zusage h2 { color: var(--ink); }
.board-cards, .closed-list { flex: 1; min-height: 60px; border-radius: 6px; }
.drop-target { outline: 2px dashed var(--accent); outline-offset: 2px; background: var(--accent-soft); }
.task-card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 0.6rem 0.7rem; margin-bottom: 0.55rem; cursor: grab; }
.task-card.dragging { opacity: 0.45; }
.task-card.is-overdue { border-color: var(--signal); }
.task-card.has-reply { box-shadow: inset 3px 0 0 var(--warn); }
.task-card.compact { padding: 0.45rem 0.6rem; }
.task-title { color: var(--ink); font-weight: 700; text-decoration: none; display: block; line-height: 1.3; }
.task-title:hover { color: var(--accent); }
.task-meta { display: flex; gap: 0.35rem 0.6rem; flex-wrap: wrap; color: var(--muted); font-size: 0.8rem; margin-top: 0.3rem; align-items: center; }
.move-form { margin-top: 0.45rem; }
.move-form select { padding: 0.25rem 0.4rem; font-size: 0.8rem; }
.js .move-form { display: none; }

/* Timeline */
.comment-form { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
.comment-form .button { align-self: flex-start; }
.timeline-list { list-style: none; margin: 0; padding: 0; }
.timeline-list li { padding: 0.65rem 0 0.65rem 0.9rem; border-left: 2px solid var(--line); margin-left: 0.3rem; }
.timeline-list header { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: baseline; font-size: 0.9rem; }
.timeline-list time { color: var(--muted); font-size: 0.82rem; }
.tl-in { border-left-color: var(--warn) !important; }
.tl-out { border-left-color: var(--accent) !important; }
.tl-draft { border-left-style: dashed !important; }
.tl-event { color: var(--muted); }
.mail-body { white-space: normal; background: var(--surface-2); border-radius: 6px; padding: 0.8rem 1rem; margin-top: 0.5rem; max-height: 32rem; overflow: auto; overflow-wrap: anywhere; }

/* Inbox */
.mail-row { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(0, 2.4fr) auto; gap: 0.8rem; padding: 0.6rem 0.2rem; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; align-items: center; }
.mail-row:last-child { border-bottom: 0; }
.mail-row:hover { background: var(--surface-2); }
.mail-row.unread .mail-who, .mail-row.unread .mail-subject { font-weight: 800; }
.mail-who, .mail-subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-meta { display: flex; gap: 0.5rem; align-items: center; color: var(--muted); font-size: 0.84rem; white-space: nowrap; }

/* Knowledge */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.8rem; margin-bottom: 1.2rem; }
.tile { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.95rem 1.05rem; color: var(--ink); text-decoration: none; }
.tile:hover { border-color: var(--accent); }
.tile strong { display: block; font-family: var(--display); font-size: 1.2rem; margin-bottom: 0.3rem; }
.tile span { color: var(--muted); font-size: 0.88rem; }
.prose h2 { margin-top: 1.4rem; font-size: 1.3rem; }
.prose h3 { margin-top: 1.1rem; }
.prose p, .prose li { max-width: 74ch; }
.prose blockquote { margin: 0.8rem 0; padding: 0.6rem 1rem; border-left: 3px solid var(--line); background: var(--surface-2); border-radius: 4px; }
.prose code { font-family: var(--mono); font-size: 0.86em; background: var(--surface-2); padding: 0.05rem 0.3rem; border-radius: 4px; }
.table-wrap { overflow-x: auto; margin: 0.6rem 0 1rem; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { text-align: left; padding: 0.5rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-size: 0.74rem; letter-spacing: 0.06em; text-transform: uppercase; }
.panel:has(> .table) { overflow-x: auto; }

/* Auth */
.auth-card { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 2rem; }
.auth-card .button-wide { margin: 0.8rem 0 1rem; }
.empty-state { padding: 3rem 0; }

/* Mobile */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(290px, 86vw); z-index: 20; transform: translateX(-102%); transition: transform 0.2s ease; }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.35); }
  .topbar { display: flex; align-items: center; gap: 0.8rem; padding: 0.65rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
  .topbar-title { font-family: var(--display); font-size: 1.1rem; }
  .menu-toggle { background: var(--ink); color: var(--paper); border: 0; border-radius: 6px; padding: 0.4rem 0.85rem; font: inherit; font-weight: 700; }
  .content { padding: 1.1rem 1rem 3rem; }
  .two-col, .two-col.wide-left, .grid-2 { grid-template-columns: 1fr; }
  .board { grid-template-columns: repeat(8, minmax(240px, 82vw)); }
  .mail-row { grid-template-columns: 1fr; gap: 0.15rem; }
  .copy-field { flex-direction: column; }
  .new-card summary { float: none; }
  .js .move-form { display: block; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }
