/* ---------------------------------------------------------------
   Praxis-Dashboard – Gestaltung
   Warmes Papier, tiefes Petrol, redaktionelle Serifen-Überschriften.
   Alle Schriften kommen vom Gerät: keine externen Font-Requests.
   --------------------------------------------------------------- */

:root {
  --sans: "Avenir Next", "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --paper:      #f2f5f4;
  --paper-deep: #e6ebe9;
  --surface:    #ffffff;
  --ink:        #14181a;
  --ink-soft:   #4d5559;
  --ink-faint:  #828c91;
  --line:       #d5dcd9;
  --line-soft:  #e5eae8;

  --brand:      #1b2126;   /* Anthrazit der Marke – Aktionen und Links */
  --brand-deep: #1b2126;   /* trägt die Seitenleiste */
  --brand-soft: #39434a;
  --accent:     #4fb37a;   /* Markengrün, für Flächen und Grafik */
  --accent-ink: #227a4c;   /* dunkler abgestimmt, wo Grün Text tragen muss */
  --logo-hub:   #8c979e;   /* Grau des Signet-Zentrums */
  --on-brand:   #ffffff;
  --amber:      #9a6510;
  --amber-soft: #f6ecd9;
  --rust:       #a33b28;
  --moss:       #3f7a44;

  --radius:    10px;
  --radius-sm: 6px;
  --shadow:    0 1px 2px rgba(20, 24, 26, .05), 0 8px 24px -12px rgba(20, 24, 26, .18);
  --shadow-lg: 0 2px 4px rgba(20, 24, 26, .06), 0 24px 48px -20px rgba(20, 24, 26, .28);
  --sidebar: 236px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:      #16191b;
    --paper-deep: #101315;
    --surface:    #1d2124;
    --ink:        #e8edea;
    --ink-soft:   #a4acaa;
    --ink-faint:  #7a8482;
    --line:       #313739;
    --line-soft:  #272c2e;

    --brand:      #4fb37a;
    --brand-deep: #15191d;
    --brand-soft: #3d8f61;
    --accent:     #4fb37a;
    --accent-ink: #6cc994;
    --logo-hub:   #8c979e;
    --on-brand:   #0b1a12;
    --amber:      #d9a353;
    --amber-soft: #33291a;
    --rust:       #d4816d;
    --moss:       #93b571;
    --shadow:    0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .5);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, .35), 0 24px 48px -20px rgba(0, 0, 0, .6);
  }
}

*, *::before, *::after { box-sizing: border-box; }

/* Eigene display-Regeln würden das hidden-Attribut sonst aushebeln. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { font-family: var(--sans); font-weight: 700; letter-spacing: -.022em; line-height: 1.2; margin: 0; }
h1 { font-size: 1.8rem; }
h2 { font-size: 1.18rem; letter-spacing: -.015em; }
h3 { font-size: 1.02rem; letter-spacing: -.01em; }
a { color: var(--brand); text-decoration-color: color-mix(in srgb, var(--brand) 35%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }

.eyebrow {
  font-size: .69rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase;
  color: var(--ink-faint); margin: 0 0 .55rem;
}

/* ---------------------------------------------------- Grundgerüst */

.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--brand-deep);
  color: #c3ccc8;
  padding: 1.6rem 1rem 1.2rem;
  display: flex; flex-direction: column; gap: 1.6rem;
  position: sticky; top: 0; height: 100vh;
  border-right: 1px solid rgba(0, 0, 0, .25);
}

.brand { display: flex; align-items: center; gap: .7rem; padding: 0 .45rem; }
.brand-mark { width: 36px; height: 36px; flex: none; color: #c8cfd3; }
.brand-mark .logo { width: 100%; height: 100%; display: block; }
.brand-name { font-size: 1.15rem; font-weight: 700; letter-spacing: -.03em; color: #f3f5f6; line-height: 1.15; }
.brand-rule { display: flex; height: 3px; margin: .3rem 0 .28rem; border-radius: 2px; overflow: hidden; }
.brand-rule i { display: block; height: 100%; }
.brand-rule i:nth-child(1) { width: 42%; background: var(--accent); }
.brand-rule i:nth-child(2) { width: 42%; background: #8c979e; }
.brand-rule i:nth-child(3) { width: 16%; background: #5c666d; }
.brand-sub { font-family: var(--mono); font-size: .55rem; letter-spacing: .2em; text-transform: uppercase; color: #6b7076; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: .65rem;
  padding: .5rem .65rem; border-radius: var(--radius-sm);
  color: #a7b2ae; text-decoration: none; font-size: .93rem;
  transition: background .15s ease, color .15s ease;
}
.nav a:hover { background: rgba(255, 255, 255, .06); color: #f0f5f2; }
.nav a.active { background: rgba(255, 255, 255, .09); color: #fff; font-weight: 600; box-shadow: inset 2px 0 0 var(--accent); }
.nav a svg { width: 17px; height: 17px; flex: none; opacity: .85; }
.nav-divider { height: 1px; background: rgba(255, 255, 255, .1); margin: .7rem .3rem; }

.sidebar-foot { border-top: 1px solid rgba(255, 255, 255, .1); padding-top: .9rem; font-size: .84rem; }
.sidebar-foot .who { color: #eef3f0; font-weight: 600; }
.sidebar-foot .role { color: #7f8a86; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; }
.sidebar-foot form { margin-top: .55rem; }
.linkbtn {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: #949e9a; font: inherit; font-size: .82rem; text-decoration: underline; text-underline-offset: 3px;
}
.linkbtn:hover { color: #eef3f0; }

.main { padding: 2.2rem 2.4rem 4rem; max-width: 1180px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.8rem; flex-wrap: wrap; }
.page-head p { margin: .35rem 0 0; color: var(--ink-soft); font-size: .93rem; }

/* ------------------------------------------------------ Bausteine */

.card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--line-soft);
}
.card-body { padding: 1.25rem; }
.card-body.tight { padding: .4rem 0; }

.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 1.5rem; }

.stat { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.stat .num { font-size: 1.95rem; font-weight: 700; letter-spacing: -.03em; line-height: 1; color: var(--accent-ink); }
.stat .lbl { font-size: .8rem; color: var(--ink-soft); margin-top: .4rem; }

.btn {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .53rem .95rem; border-radius: var(--radius-sm);
  border: 1px solid var(--brand); background: var(--brand); color: var(--on-brand);
  font: 600 .9rem/1.2 var(--sans); cursor: pointer; text-decoration: none;
  transition: transform .12s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--paper-deep); filter: none; }
.btn-sm { padding: .32rem .6rem; font-size: .8rem; }
.btn-danger { background: transparent; border-color: var(--line); color: var(--rust); }
.btn-danger:hover { background: color-mix(in srgb, var(--rust) 10%, transparent); filter: none; }

label { display: block; font-size: .82rem; font-weight: 600; color: var(--ink-soft); margin-bottom: .3rem; }
input[type=text], input[type=email], input[type=password], input[type=date], select, textarea {
  width: 100%; padding: .55rem .7rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--paper); color: var(--ink); font: 400 .93rem/1.5 var(--sans);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 1px;
  border-color: var(--brand-soft);
}
textarea { resize: vertical; min-height: 80px; }
.field { margin-bottom: .9rem; }
.field-row { display: flex; gap: .8rem; flex-wrap: wrap; }
.field-row > * { flex: 1 1 150px; }

.tag {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .74rem; font-weight: 600; padding: .18rem .5rem; border-radius: 999px;
  background: var(--paper-deep); color: var(--ink-soft);
}
.tag-amber { background: var(--amber-soft); color: var(--amber); }
.tag-rust  { background: color-mix(in srgb, var(--rust) 14%, transparent); color: var(--rust); }
.tag-moss  { background: color-mix(in srgb, var(--moss) 15%, transparent); color: var(--moss); }

.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex; align-items: center; gap: .8rem;
  padding: .7rem 1.25rem; border-bottom: 1px solid var(--line-soft);
}
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .name { display: block; font-weight: 600; font-size: .93rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .meta { display: block; font-size: .78rem; color: var(--ink-faint); margin-top: .1rem; }

.empty { padding: 2rem 1.25rem; text-align: center; color: var(--ink-faint); font-size: .9rem; }
.empty strong { display: block; font-weight: 700; font-size: 1rem; letter-spacing: -.01em; color: var(--ink-soft); margin-bottom: .3rem; }

.notice { padding: .75rem 1rem; border-radius: var(--radius-sm); font-size: .9rem; margin-bottom: 1.2rem; border: 1px solid; }
.notice-error { background: color-mix(in srgb, var(--rust) 10%, transparent); border-color: color-mix(in srgb, var(--rust) 35%, transparent); color: var(--rust); }
.notice-ok    { background: color-mix(in srgb, var(--moss) 12%, transparent); border-color: color-mix(in srgb, var(--moss) 35%, transparent); color: var(--moss); }
.notice-info  { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 35%, transparent); color: var(--amber); }

/* ------------------------------------------------------- Anmeldung */

.login-page {
  /* Bewusst immer dunkel – das ist der Markenauftritt vor dem Arbeitsbereich. */
  --surface:   #1c2124;
  --paper:     #0e1113;
  --ink:       #eef2f0;
  --ink-soft:  #9aa4a1;
  --ink-faint: #79837f;
  --line:      #2f3639;
  --line-soft: #262c2f;
  --brand:     #4fb37a;
  --brand-soft:#3d8f61;
  --on-brand:  #0b1a12;
  --accent:    #4fb37a;
  --accent-ink:#6cc994;
  --logo-hub:  #8c979e;

  min-height: 100vh; display: grid; place-items: center; padding: 2rem;
  color: var(--ink);
  background:
    radial-gradient(900px 460px at 18% -10%, rgba(79, 179, 122, .11), transparent 62%),
    radial-gradient(700px 380px at 88% 112%, rgba(140, 151, 158, .07), transparent 60%),
    linear-gradient(168deg, #232a30 0%, #1b2126 56%, #12171a 100%);
}
.login-card {
  width: 100%; max-width: 384px; padding: 2.1rem 1.95rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .015));
  border: 1px solid rgba(255, 255, 255, .09); border-radius: 14px;
  box-shadow: 0 30px 70px -30px rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 255, 255, .06);
  backdrop-filter: blur(6px);
}
.login-card .brand-mark { width: 60px; height: 60px; margin-bottom: 1.3rem; color: #c8cfd3; }
.login-card h1 { font-family: var(--sans); font-weight: 700; font-size: 1.65rem; letter-spacing: -.02em; margin-bottom: .3rem; }
.login-card h1 + .brand-rule { max-width: 210px; margin: .55rem 0 .5rem; height: 4px; }
.login-card .sub {
  font-family: var(--mono); color: var(--ink-faint); font-size: .68rem;
  letter-spacing: .2em; text-transform: uppercase; margin: 0 0 1.7rem;
}
.login-card .btn { width: 100%; justify-content: center; margin-top: .4rem; }

/* ----------------------------------------------------- Aufgaben */

.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; align-items: start; }
.column { background: var(--paper-deep); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: .85rem; min-height: 180px; transition: background .15s ease, outline-color .15s ease; outline: 2px dashed transparent; outline-offset: -4px; }
.column.drop { background: color-mix(in srgb, var(--brand) 9%, var(--paper-deep)); outline-color: color-mix(in srgb, var(--brand) 45%, transparent); }
.column-head { display: flex; align-items: center; justify-content: space-between; margin: .15rem .3rem .8rem; }
.column-head .eyebrow { margin: 0; }
.column-count { font-size: .76rem; color: var(--ink-faint); background: var(--surface); border: 1px solid var(--line-soft); border-radius: 999px; padding: .05rem .45rem; }

.task {
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  padding: .7rem .8rem; margin-bottom: .6rem; box-shadow: var(--shadow); cursor: grab;
}
.task:active { cursor: grabbing; }
.task.dragging { opacity: .45; }
.task h3 { font-family: var(--sans); font-size: .92rem; font-weight: 600; }
.task p { margin: .35rem 0 0; font-size: .84rem; color: var(--ink-soft); }
.task-foot { display: flex; align-items: center; gap: .4rem; margin-top: .6rem; flex-wrap: wrap; }
.task-foot form { margin-left: auto; }
.task.done h3 { text-decoration: line-through; color: var(--ink-faint); }

/* ------------------------------------------------------- Ablage */

.crumbs { display: flex; align-items: center; gap: .4rem; font-size: .84rem; color: var(--ink-faint); flex-wrap: wrap; margin-bottom: .35rem; }
.crumbs a { text-decoration: none; }
.crumbs span.sep { opacity: .45; }

.filterleiste {
  display: flex; gap: .5rem; flex-wrap: wrap; align-items: center;
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: .6rem .7rem; margin-bottom: 1.1rem;
}
.filterleiste input[type=search] { flex: 1 1 240px; min-width: 180px; }
.filterleiste select { flex: 0 1 150px; font-size: .86rem; padding: .45rem .5rem; }

/* Aufklapp-Formulare in Kopfzeile und Zeilenmenü */
.pop {
  position: absolute; right: 0; top: 2.4rem; z-index: 20; width: 250px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: .85rem; box-shadow: var(--shadow-lg);
}
.pop-menue label { font-size: .78rem; }
.pop-menue input[type=text] { margin-bottom: .5rem; }
.menue-link { display: block; margin-top: .6rem; padding-top: .6rem; border-top: 1px solid var(--line-soft); font-size: .84rem; text-decoration: none; }

/* Ablage-Fläche beim Ziehen */
.dropzone {
  position: fixed; inset: 12px; z-index: 60;
  border: 2px dashed var(--brand-soft); border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 94%, var(--accent));
  display: grid; place-content: center; text-align: center; pointer-events: none;
  box-shadow: var(--shadow-lg);
}
.dropzone strong { display: block; font-size: 1.3rem; font-weight: 700; letter-spacing: -.02em; margin-bottom: .3rem; }
.dropzone small { color: var(--ink-soft); }

.uploadliste {
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: .8rem 1rem; margin-bottom: 1.1rem; font-size: .88rem;
}
.upload-kopf { color: var(--ink-soft); margin-bottom: .5rem; }
.upload-fertig { color: var(--accent-ink); font-weight: 600; }
.upload-fehler { color: var(--rust); }
.progress { height: 4px; border-radius: 999px; background: var(--paper-deep); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s ease; }

/* Aktionsleiste bei Mehrfachauswahl */
.aktionsleiste {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: var(--brand-deep); color: #eef2f0; border-radius: var(--radius);
  padding: .55rem .9rem; margin-bottom: .8rem; font-size: .88rem;
  position: sticky; top: .6rem; z-index: 15; box-shadow: var(--shadow-lg);
}
.aktionsleiste-knoepfe { display: flex; gap: .45rem; align-items: center; margin-left: auto; flex-wrap: wrap; }
.aktionsleiste select { width: auto; min-width: 150px; padding: .35rem .5rem; font-size: .84rem; background: rgba(255,255,255,.1); color: #eef2f0; border-color: rgba(255,255,255,.2); }
.aktionsleiste .linkbtn { color: #a7b2ae; }
.aktionsleiste .linkbtn:hover { color: #fff; }

/* Die Liste selbst */
table.ablage { table-layout: auto; }
table.ablage td { padding: .5rem .7rem; vertical-align: middle; }
table.ablage th { padding: .5rem .7rem; }
.spalte-check { width: 30px; }
.spalte-typ { width: 42px; }
.spalte-meta { width: 150px; color: var(--ink-soft); font-size: .84rem; white-space: nowrap; }
.spalte-groesse { width: 88px; color: var(--ink-soft); font-size: .84rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.spalte-aktion { width: 96px; }
.sortkopf { text-decoration: none; color: inherit; }
.sortkopf:hover { color: var(--ink); }

.zeile { transition: background .12s ease; }
.zeile:hover { background: color-mix(in srgb, var(--ink) 3%, transparent); }
.zeile.gewaehlt { background: color-mix(in srgb, var(--accent) 11%, transparent); }
.zeile.zieht { opacity: .4; }
.zeile.ziel-aktiv { background: color-mix(in srgb, var(--accent) 20%, transparent); outline: 2px solid var(--brand-soft); outline-offset: -2px; }
.zeile-datei { cursor: grab; }
.zeile-datei:active { cursor: grabbing; }
.zeile.hoch a { color: var(--ink-faint); }
.hoch-link { display: inline-flex; align-items: center; gap: .45rem; font-size: .84rem; text-decoration: none; }
.hoch-link:hover { color: var(--ink); }

.eintrag-name { display: block; font-weight: 600; font-size: .93rem; text-decoration: none; color: var(--ink); }
.eintrag-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.eintrag-meta { display: block; font-size: .78rem; color: var(--ink-faint); margin-top: .1rem; }

/* Typsymbole */
.typ {
  position: relative; display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--paper-deep); color: var(--ink-soft);
}
.typ svg { width: 18px; height: 18px; }
.typ b {
  position: absolute; bottom: -3px; right: -4px;
  font-size: .48rem; font-weight: 700; letter-spacing: .02em;
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: 3px;
  padding: 0 2px; color: var(--ink-faint); max-width: 30px; overflow: hidden;
}
.typ-ordner { background: color-mix(in srgb, var(--amber) 15%, transparent); color: var(--amber); }
.typ-bild { background: color-mix(in srgb, #4f86b3 16%, transparent); color: #3f77a4; }
.typ-pdf { background: color-mix(in srgb, var(--rust) 14%, transparent); color: var(--rust); }
.typ-tabelle { background: color-mix(in srgb, var(--accent) 17%, transparent); color: var(--accent-ink); }
.typ-praesentation { background: color-mix(in srgb, #b3814f 16%, transparent); color: #96692f; }
.typ-video, .typ-audio { background: color-mix(in srgb, #7a5fb3 15%, transparent); color: #6a51a1; }
@media (prefers-color-scheme: dark) {
  .typ-bild { color: #7fb0d8; }
  .typ-praesentation { color: #d0a06a; }
  .typ-video, .typ-audio { color: #a68fd8; }
}

.zeilenaktionen { display: flex; gap: .15rem; align-items: center; justify-content: flex-end; opacity: 0; transition: opacity .12s ease; }
.zeile:hover .zeilenaktionen, .zeilenaktionen:focus-within { opacity: 1; }
.zeilenaktionen .ikon, .zeilenmenue summary {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 6px;
  color: var(--ink-faint); text-decoration: none; cursor: pointer; list-style: none;
}
.zeilenaktionen .ikon:hover, .zeilenmenue summary:hover { background: var(--paper-deep); color: var(--ink); }
.zeilenmenue { position: relative; display: inline-block; }
.zeilenmenue summary::-webkit-details-marker { display: none; }
.spalte-aktion .zeilenmenue summary { opacity: 1; }
tr:has(.zeilenmenue[open]) { position: relative; z-index: 25; }

/* Detailseite */
.vorschau { background: var(--paper-deep); border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; }
.vorschau img { display: block; width: 100%; height: auto; max-height: 70vh; object-fit: contain; }
.vorschau iframe { display: block; width: 100%; height: 70vh; border: 0; background: var(--surface); }
.vorschau iframe.text { height: 40vh; padding: 0; }

/* -------------------------------------------------------- Notizen */

.notes { columns: 2; column-gap: 1.25rem; }
.note { break-inside: avoid; margin-bottom: 1.25rem; }
.note.pinned { border-color: color-mix(in srgb, var(--amber) 45%, transparent); }
.note .card-body p { margin: .5rem 0 0; white-space: pre-wrap; font-size: .93rem; color: var(--ink-soft); }
.note-foot { display: flex; align-items: center; gap: .6rem; padding: .6rem 1.25rem; border-top: 1px solid var(--line-soft); font-size: .78rem; color: var(--ink-faint); }
.note-foot form { margin-left: auto; }

/* --------------------------------------------------------- Tabelle */

table { width: 100%; border-collapse: collapse; font-size: .91rem; }
th { text-align: left; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); padding: .6rem 1.25rem; border-bottom: 1px solid var(--line); }
td { padding: .7rem 1.25rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.inactive td { opacity: .55; }
td .actions { display: flex; gap: .4rem; justify-content: flex-end; }

.credential { font-family: var(--mono); font-size: 1rem; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: .5rem .7rem; display: inline-block; margin-top: .4rem; user-select: all; }

/* ------------------------------------------------------- Bewegung */

.reveal { animation: rise .45s cubic-bezier(.22, .8, .3, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---------------------------------------------------------- Mobil */

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; gap: .8rem; padding: .9rem 1rem; }
  .nav { flex-direction: row; flex-wrap: wrap; flex: 1 1 100%; }
  .nav-divider { display: none; }
  .sidebar-foot { border-top: 0; padding-top: 0; margin-left: auto; display: flex; align-items: center; gap: .8rem; }
  .sidebar-foot form { margin-top: 0; }
  .main { padding: 1.4rem 1.1rem 3rem; }
  .board { grid-template-columns: 1fr; }
  .notes { columns: 1; }
  table { font-size: .85rem; }
  th, td { padding: .55rem .7rem; }
}

/* ------------------------------------------------------- Finanzgrafik */

:root {
  /* Serienfarben, gegen die Fläche und auf Farbsehschwächen geprüft */
  --c-ein: #4fb37a;
  --c-aus: #a8553c;
}
@media (prefers-color-scheme: dark) {
  :root { --c-ein: #48a972; --c-aus: #b06340; }
}

.chart { margin: 0; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-legende {
  display: flex; gap: 1.1rem; flex-wrap: wrap; align-items: center;
  font-size: .82rem; color: var(--ink-soft); margin-bottom: .6rem;
}
.chart-legende .key { width: 11px; height: 11px; border-radius: 3px; display: inline-block; vertical-align: -1px; margin-right: .3rem; }
.key-ein { background: var(--c-ein); }
.key-aus { background: var(--c-aus); }
.key-plan { background: repeating-linear-gradient(45deg, var(--ink-faint) 0 2px, transparent 2px 4px); border: 1px solid var(--line); }
.key-hint { color: var(--ink-faint); margin-left: auto; }

.raster { stroke: var(--line-soft); stroke-width: 1; }
.achse  { stroke: var(--line); stroke-width: 1; }
.trenner { stroke: var(--ink-faint); stroke-width: 1; stroke-dasharray: 3 3; opacity: .6; }
.achsen-text { fill: var(--ink-faint); font: 400 10px var(--sans); }

.plan-grund.plan-ein  { fill: color-mix(in srgb, var(--c-ein) 22%, transparent); }
.plan-grund.plan-aus  { fill: color-mix(in srgb, var(--c-aus) 22%, transparent); }
.plan-strich.plan-ein-strich { stroke: color-mix(in srgb, var(--c-ein) 75%, transparent); }
.plan-strich.plan-aus-strich { stroke: color-mix(in srgb, var(--c-aus) 75%, transparent); }

.monat .treffer { fill: transparent; }
.monat:hover .treffer { fill: color-mix(in srgb, var(--ink) 5%, transparent); }
.monat { cursor: default; }

.chart-tabelle { margin-top: .9rem; }
.chart-tabelle summary {
  font-size: .82rem; color: var(--ink-soft); cursor: pointer;
  padding: .3rem 0; list-style-position: inside;
}
.chart-tabelle summary:hover { color: var(--ink); }
.chart-tabelle table { margin-top: .5rem; }
.chart-tabelle th, .chart-tabelle td { padding: .35rem .6rem; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
td.minus { color: var(--rust); }

/* --------------------------------------------------------- Finanzen */

.kennzahlen { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 1rem; margin-bottom: 1.4rem; }
.kennzahl {
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 1.1rem 1.2rem;
}
.kennzahl .wert { font-size: 1.7rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kennzahl .wert.plus  { color: var(--accent-ink); }
.kennzahl .wert.minus { color: var(--rust); }
.kennzahl .lbl { font-size: .78rem; color: var(--ink-soft); margin-top: .35rem; }
.kennzahl .zusatz { font-size: .74rem; color: var(--ink-faint); margin-top: .5rem; padding-top: .5rem; border-top: 1px solid var(--line-soft); }

.balkenziel { height: 6px; border-radius: 999px; background: var(--paper-deep); overflow: hidden; margin-top: .6rem; }
.balkenziel i { display: block; height: 100%; background: var(--accent); }

.bereich-zeile td:first-child strong { display: block; }
/* Zusatzangabe unter dem Namen – gilt in allen Tabellen. */
.quelle { display: block; font-size: .74rem; color: var(--ink-faint); margin-top: .1rem; font-weight: 400; }
.subnav { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.subnav a {
  padding: .35rem .75rem; border-radius: 999px; font-size: .85rem; text-decoration: none;
  border: 1px solid var(--line); color: var(--ink-soft); background: var(--surface);
}
.subnav a:hover { border-color: var(--brand-soft); color: var(--ink); }
.subnav a.active { background: var(--brand); border-color: var(--brand); color: var(--on-brand); font-weight: 600; }

@media (max-width: 760px) {
  .spalte-meta, .spalte-groesse { display: none; }
  .filterleiste select { flex: 1 1 45%; }
  .aktionsleiste { position: static; }
  .aktionsleiste-knoepfe { margin-left: 0; width: 100%; }
  .zeilenaktionen { opacity: 1; }
  .grid[style*="minmax(260px"] { grid-template-columns: 1fr !important; }
}

/* -------------------------------------------------- Buchhaltung */

.wahlschalter { display: flex; gap: .4rem; margin-bottom: 1rem; }
.wahlschalter label {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .5rem .6rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: .88rem; font-weight: 600; color: var(--ink-soft); cursor: pointer; margin: 0;
  transition: border-color .12s ease, background .12s ease, color .12s ease;
}
.wahlschalter label:has(input:checked) { border-color: var(--brand); background: var(--brand); color: var(--on-brand); }
.wahlschalter label:has(input:checked).wahl-ein { border-color: var(--accent-ink); background: var(--accent-ink); color: #fff; }
.wahlschalter input { width: auto; margin: 0; accent-color: currentColor; }
.wahlschalter.klein label { font-weight: 400; font-size: .82rem; padding: .35rem .5rem; }

.feldhinweis { font-size: .78rem; color: var(--ink-faint); margin: .35rem 0 0; }

.rechenvorschau {
  background: var(--paper-deep); border-radius: var(--radius-sm);
  padding: .6rem .8rem; margin-bottom: 1rem; font-size: .86rem;
}
.rechenvorschau div { display: flex; justify-content: space-between; padding: .12rem 0; color: var(--ink-soft); }
.rechenvorschau b { font-variant-numeric: tabular-nums; color: var(--ink); }
.rechenvorschau .summe { border-top: 1px solid var(--line); margin-top: .3rem; padding-top: .35rem; font-weight: 600; }

table.euer td.zeile, table.euer th.zeile { width: 52px; color: var(--ink-faint); font-size: .8rem; font-variant-numeric: tabular-nums; }
table.euer .unterzeile td { padding-top: 0; color: var(--ink-soft); font-size: .85rem; }
tr.summenzeile td { border-top: 1.5px solid var(--line); background: color-mix(in srgb, var(--ink) 3%, transparent); }
tr.gewaehlt td { background: color-mix(in srgb, var(--accent) 12%, transparent); }
tr.storniert td { opacity: .5; text-decoration: line-through; }
tr.storniert td:last-child, tr.stornozeile td { text-decoration: none; }
tr.stornozeile td { opacity: .75; font-style: italic; }

.belegnr { font-family: var(--mono); font-size: .8rem; text-decoration: none; }
.ohnebeleg {
  display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%;
  background: color-mix(in srgb, var(--amber) 22%, transparent); color: var(--amber);
  font-size: .64rem; font-weight: 700; vertical-align: 1px; margin-left: .2rem; cursor: help;
}

/* Betragsspalten dürfen nie umbrechen – Zahlen liest man sonst zweimal falsch. */
td.r, th.r { white-space: nowrap; }
table.euer td.r, table.euer th.r { font-variant-numeric: tabular-nums; }

/* Im Kassenbuch neben dem Erfassungsformular wird es eng: Netto und Steuersatz
   sind Details, die auf schmalen Flächen weichen dürfen – Brutto bleibt. */
@media (max-width: 1400px) {
  .kassenbuch .spalte-netto, .kassenbuch .spalte-ust { display: none; }
}
.kassenbuch td, .kassenbuch th { padding: .5rem .55rem; }

/* ------------------------------------------------- Ablage: Aufbau */

.ablage-raster { display: grid; grid-template-columns: 200px 1fr; gap: 1.25rem; align-items: start; }
.ablage-baum { position: sticky; top: .6rem; }
.ablage-baum .eyebrow { margin-bottom: .4rem; }
.baum-kopf { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin-bottom: .35rem; }
.baum-kopf .eyebrow { margin: 0; }
.baum-kopf .linkbtn { font-size: .72rem; color: var(--ink-faint); }
.baum-kopf .linkbtn:hover { color: var(--ink); }

.baum-zeile {
  display: flex; align-items: center; gap: .1rem;
  border-radius: var(--radius-sm); padding-right: .3rem;
  color: var(--ink-soft); white-space: nowrap;
}
.baum-zeile:hover { background: var(--paper-deep); color: var(--ink); }
.baum-zeile.aktiv { background: var(--paper-deep); color: var(--ink); font-weight: 600; }
.baum-zeile.ziel-aktiv { background: color-mix(in srgb, var(--accent) 25%, transparent); color: var(--ink); outline: 1px solid var(--brand-soft); }

.baum-name {
  display: flex; align-items: center; gap: .4rem; flex: 1; min-width: 0;
  padding: .3rem .2rem; font-size: .86rem; color: inherit; text-decoration: none;
}
.baum-name span { overflow: hidden; text-overflow: ellipsis; }
.baum-name svg { flex: none; opacity: .75; }

.baum-pfeil {
  flex: none; display: grid; place-items: center; width: 16px; height: 20px;
  border: 0; background: none; padding: 0; cursor: pointer; color: var(--ink-faint);
}
.baum-pfeil svg { transition: transform .15s ease; }
.baum-pfeil.offen svg { transform: rotate(90deg); }
.baum-pfeil:hover { color: var(--ink); }
.baum-luecke { flex: none; width: 16px; }

.kopf-werkzeuge { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.ansichtswahl { display: flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.ansichtswahl a { display: grid; place-items: center; width: 32px; height: 30px; color: var(--ink-faint); background: var(--surface); }
.ansichtswahl a:hover { color: var(--ink); }
.ansichtswahl a.aktiv { background: var(--brand); color: var(--on-brand); }

/* Kacheln */
.kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: .9rem; }
.kachel {
  position: relative; background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--radius); overflow: hidden; transition: border-color .12s ease, box-shadow .12s ease;
}
.kachel:hover { border-color: var(--line); box-shadow: var(--shadow); }
.kachel.gewaehlt { border-color: var(--brand-soft); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
.kachel.zieht { opacity: .4; }
.kachel.ziel-aktiv { border-color: var(--brand-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent); }
.kachel-flaeche { display: block; text-decoration: none; color: inherit; }
.kachel-bild {
  aspect-ratio: 4 / 3; display: grid; place-items: center;
  background: var(--paper-deep); overflow: hidden; color: var(--ink-faint);
}
.kachel-bild img { width: 100%; height: 100%; object-fit: cover; display: block; }
.kachel-bild.ordner svg { width: 46px; height: 46px; color: var(--amber); opacity: .85; }
.kachel-bild .typ { width: 46px; height: 46px; background: transparent; }
.kachel-bild .typ svg { width: 26px; height: 26px; }
.kachel-bild .typ b { font-size: .55rem; bottom: -2px; right: -2px; }
.kachel-text { padding: .55rem .65rem .65rem; }
.kachel-name { display: block; font-size: .85rem; font-weight: 600; line-height: 1.3; overflow: hidden;
  text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.kachel-meta { display: block; font-size: .74rem; color: var(--ink-faint); margin-top: .2rem; }
.kachel-wahl {
  position: absolute; top: .45rem; left: .45rem; z-index: 2; width: auto;
  opacity: 0; transition: opacity .12s ease;
}
.kachel:hover .kachel-wahl, .kachel-wahl:checked, .kachel.gewaehlt .kachel-wahl { opacity: 1; }
.kachel .stern { position: absolute; top: .35rem; right: .35rem; z-index: 2; background: color-mix(in srgb, var(--surface) 80%, transparent); }
.kachel-lupe {
  position: absolute; bottom: 3.1rem; right: .45rem; z-index: 2;
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  border: 0; background: color-mix(in srgb, var(--surface) 88%, transparent); color: var(--ink-soft);
  cursor: pointer; opacity: 0; transition: opacity .12s ease; box-shadow: var(--shadow);
}
.kachel:hover .kachel-lupe { opacity: 1; }
.kachel-lupe:hover { color: var(--ink); }

/* Kleine Bildvorschau in der Liste */
.minibild { display: block; width: 34px; height: 34px; border-radius: 7px; overflow: hidden; background: var(--paper-deep); }
.minibild img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Sterne */
.stern { border: 0; background: none; }
.stern.an { color: var(--amber); }
.zeilenaktionen .stern { opacity: 1; }
.zeile .stern:not(.an) { opacity: 0; }
.zeile:hover .stern, .zeile .stern.an { opacity: 1; }

.menue-form { margin-top: .6rem; padding-top: .6rem; border-top: 1px solid var(--line-soft); }
.menue-form label { font-size: .78rem; }
.menue-form select { margin-bottom: .5rem; }

/* Schnellansicht */
.lichtkasten {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 3rem 2rem;
  background: rgba(12, 15, 17, .82); backdrop-filter: blur(3px);
}
.lichtkasten figure { margin: 0; max-width: 1000px; width: 100%; }
.lichtkasten img { display: block; max-width: 100%; max-height: 76vh; margin: 0 auto; border-radius: var(--radius); background: #fff; }
.lichtkasten iframe { width: 100%; height: 76vh; border: 0; border-radius: var(--radius); background: #fff; }
.lichtkasten figcaption { text-align: center; color: #e6ebe9; font-size: .88rem; margin-top: .9rem; }
.lichtkasten figcaption a { color: #9fe0b8; }
.lichtkasten-zu {
  position: absolute; top: 1rem; right: 1.3rem; width: 38px; height: 38px; border-radius: 50%;
  border: 0; background: rgba(255, 255, 255, .12); color: #fff; font-size: 1.5rem; line-height: 1; cursor: pointer;
}
.lichtkasten-zu:hover { background: rgba(255, 255, 255, .22); }

/* Freigabeseite nach außen */
.freigabe-seite { background: var(--paper); min-height: 100vh; display: flex; flex-direction: column; }
.freigabe-kopf {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.6rem; background: var(--brand-deep); color: #eef2f0;
}
.freigabe-kopf .marke { display: flex; align-items: center; gap: .7rem; }
.freigabe-kopf .brand-mark { width: 32px; height: 32px; color: #c8cfd3; display: block; }
.freigabe-inhalt { flex: 1; width: 100%; max-width: 940px; margin: 0 auto; padding: 2.2rem 1.4rem 3rem; }
.freigabe-inhalt .unterzeile { color: var(--ink-soft); font-size: .9rem; margin: .4rem 0 0; }
.freigabe-inhalt .notiz {
  margin: 1rem 0 0; padding: .7rem .9rem; border-left: 3px solid var(--accent);
  background: var(--surface); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: .92rem;
}
.freigabe-inhalt .hinweis { font-size: .84rem; color: var(--ink-faint); margin-top: .8rem; }
.freigabe-fuss { padding: 1.2rem; text-align: center; font-size: .8rem; color: var(--ink-faint); border-top: 1px solid var(--line-soft); }

@media (max-width: 900px) {
  .ablage-raster { grid-template-columns: 1fr; }
  .ablage-baum { position: static; display: flex; gap: .3rem; overflow-x: auto; padding-bottom: .4rem; }
  .ablage-baum .eyebrow { display: none; }
  .baum-zeile { padding-left: .3rem !important; border: 1px solid var(--line-soft); background: var(--surface); flex: none; }
  .baum-knoten { display: contents; }
  .baum-kinder { display: contents; }
  .baum-kopf .linkbtn { display: none; }
}

/* --------------------------------------------- Kunden und Projekte */

/* Gesprächsverlauf als Zeitstrahl */
.verlauf { list-style: none; margin: 0; padding: .8rem 1.25rem 1rem; }
.verlauf-punkt { position: relative; padding: 0 0 1rem 1.3rem; border-left: 2px solid var(--line-soft); }
.verlauf-punkt:last-child { border-left-color: transparent; padding-bottom: .2rem; }
.verlauf-punkt::before {
  content: ''; position: absolute; left: -6px; top: .35rem;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--line);
}
.verlauf-punkt.art-anruf::before   { border-color: var(--accent-ink); }
.verlauf-punkt.art-mail::before    { border-color: #4f86b3; }
.verlauf-punkt.art-treffen::before { border-color: var(--amber); }
.verlauf-punkt.art-angebot::before { border-color: var(--brand); background: var(--brand); }
.verlauf-kopf { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; font-size: .84rem; }
.verlauf-kopf strong { font-size: .86rem; }
.verlauf-kopf span { color: var(--ink-faint); }
.verlauf-kopf form { margin-left: auto; }
.verlauf-punkt p { margin: .3rem 0 0; font-size: .9rem; color: var(--ink-soft); white-space: pre-wrap; }

/* Projektbrett */
.projektboard { grid-template-columns: repeat(4, 1fr); }
.projektkarte {
  display: block; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  padding: .7rem .8rem; margin-bottom: .6rem; box-shadow: var(--shadow);
}
.projektkarte:hover { border-color: var(--brand-soft); }
.projektkarte strong { display: block; font-size: .9rem; letter-spacing: -.01em; }
.projektkarte .kunde { display: block; font-size: .78rem; color: var(--ink-faint); margin-top: .1rem; }
.projektkarte-fuss { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .55rem; }
.projektkarte-fuss .tag { font-size: .7rem; }

/* Wochenleiste der Zeiterfassung */
.wochenleiste { display: grid; grid-template-columns: repeat(7, 1fr); gap: .4rem; margin-bottom: 1.4rem; }
.wochentag {
  display: flex; flex-direction: column; align-items: center; gap: .1rem;
  padding: .55rem .3rem; border-radius: var(--radius-sm); text-decoration: none;
  background: var(--surface); border: 1px solid var(--line-soft); color: var(--ink-soft);
}
.wochentag:hover { border-color: var(--line); }
.wochentag.gewaehlt { border-color: var(--brand); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--ink); }
.wochentag.heute .tagzahl { color: var(--accent-ink); font-weight: 700; }
.wochentag .tagname { font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); }
.wochentag .tagzahl { font-size: 1.1rem; font-weight: 600; line-height: 1.1; }
.wochentag .tagsumme { font-size: .72rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }

@media (max-width: 1100px) { .projektboard { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) {
  .projektboard { grid-template-columns: 1fr; }
  .wochenleiste { grid-template-columns: repeat(4, 1fr); }
}
