/* RK-IT Kalender v0.7.0 - Struktur.
   Farben kommen aus themes.css (.theme-*), Form und Dichte aus styles.css (.style-*).
   Beide Klassen sitzen am <html>. Die Werte hier sind nur Rueckfallebene. */
:root {
  --ok: #1a7f45;
  --warn: #b4530a;
  --no: #b02a2a;

  --radius: 0px; --radius-sm: 0px; --radius-pill: 0px;
  --font-ui: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-head: var(--font-ui);
  --font-mono: ui-monospace, Menlo, Consolas, monospace;
  --fs-base: 14px;
  --bar-y: 10px; --bar-x: 16px; --cell-pad: 4px;
  --border-w: 1px;
  --elev-1: none; --elev-2: 0 2px 10px var(--shadow);
  --btn-pad: 7px 14px; --btn-weight: 600;
  --label-tf: uppercase; --label-tr: .06em; --label-fs: 12px;
  --head-weight: 700; --head-tracking: -0.01em;
  --ev-left: 3px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  color: var(--ink);
  background: var(--bg);
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
.hidden { display: none !important; }
.spacer { flex: 1; }

input[type=text], input[type=email], input[type=password], input[type=url], input[type=search],
input[type=date], input[type=datetime-local], input[type=number], select, textarea {
  background: var(--field); border: 1px solid var(--line); color: var(--ink); border-radius: var(--radius-sm);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* ---------- Login ---------- */
#login {
  position: fixed; inset: 0; z-index: 100;
  display: grid; grid-template-columns: 1fr 420px;
  background: var(--rail);
}
#login .brandpane {
  position: relative; overflow: hidden; isolation: isolate;
  padding: 48px; color: var(--rail-fg); display: flex; flex-direction: column; justify-content: space-between;
  border-right: 1px solid var(--rail-line);
  /* Weiche Farbwolken aus der Akzentfarbe der jeweiligen Designvorlage */
  background:
    radial-gradient(110% 85% at 8% 0%,  color-mix(in srgb, var(--accent) 26%, transparent) 0%, transparent 58%),
    radial-gradient(90% 70% at 100% 100%, color-mix(in srgb, var(--accent) 16%, transparent) 0%, transparent 55%),
    radial-gradient(70% 60% at 65% 35%, color-mix(in srgb, var(--accent) 8%, transparent) 0%, transparent 60%),
    var(--rail);
}
/* Feines Kalenderraster, nach unten ausgeblendet */
#login .brandpane::before {
  content: ''; position: absolute; inset: 0; z-index: -2; pointer-events: none;
  background-image:
    repeating-linear-gradient(to right,  color-mix(in srgb, var(--rail-fg) 14%, transparent) 0 1px, transparent 1px 104px),
    repeating-linear-gradient(to bottom, color-mix(in srgb, var(--rail-fg) 10%, transparent) 0 1px, transparent 1px 58px);
  -webkit-mask-image: radial-gradient(120% 100% at 20% 0%, #000 0%, transparent 72%);
          mask-image: radial-gradient(120% 100% at 20% 0%, #000 0%, transparent 72%);
}
/* Terminblöcke wie im Kalender selbst - erklären das Produkt ohne ein Wort */
#login .loginart { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
#login .loginart span {
  position: absolute; display: block;
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 62%, transparent);
  border: 1px solid color-mix(in srgb, var(--rail-fg) 12%, transparent);
  border-left: 3px solid color-mix(in srgb, var(--accent) 70%, transparent);
  box-shadow: 0 14px 40px -18px var(--shadow);
  backdrop-filter: blur(2px);
  animation: loginfloat 14s ease-in-out infinite;
}
#login .loginart .a1 { left: 14%; top: 26%; width: 190px; height: 62px; animation-delay: -1s; }
#login .loginart .a2 { left: 33%; top: 46%; width: 150px; height: 96px; animation-delay: -5s; opacity: .85; }
#login .loginart .a3 { left: 56%; top: 20%; width: 168px; height: 48px; animation-delay: -9s; opacity: .7; }
#login .loginart .a4 { left: 62%; top: 62%; width: 132px; height: 74px; animation-delay: -3s; opacity: .55; }

/* Angedeutete Beschriftung: Titelzeile und Uhrzeit */
#login .loginart span::before,
#login .loginart span::after {
  content: ''; position: absolute; left: 12px; border-radius: 3px;
}
#login .loginart span::before {
  top: 13px; height: 7px; width: 56%;
  background: color-mix(in srgb, var(--rail-fg) 26%, transparent);
}
#login .loginart span::after {
  top: 27px; height: 6px; width: 32%;
  background: color-mix(in srgb, var(--accent) 60%, transparent);
}

@keyframes loginfloat {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50%      { transform: translate3d(0, -14px, 0); }
}
@media (prefers-reduced-motion: reduce) {
  #login .loginart span { animation: none; }
}
#login h1 { font-size: 40px; letter-spacing: -0.02em; margin: 0 0 8px; font-weight: 700; }
#login .sub { color: var(--rail-muted); max-width: 46ch; line-height: 1.6; }
#login .formpane { background: var(--surface); padding: 48px 40px; display: flex; flex-direction: column; }
#login form { margin-top: auto; margin-bottom: auto; }
#login label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); margin: 18px 0 6px; }
#login input { width: 100%; padding: 11px 12px; }
#login button { width: 100%; margin-top: 24px; padding: 12px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 600; letter-spacing: .02em; }
.legal { border-top: 1px solid var(--line); padding-top: 14px; font-size: 12px; color: var(--ink-2); display: flex; gap: 18px; flex-wrap: wrap; }
.legal a { text-decoration: none; }
.legal a:hover { text-decoration: underline; }
.err { margin-top: 14px; padding: 9px 11px; border-left: 3px solid var(--no); background: color-mix(in srgb, var(--no) 8%, var(--surface)); color: var(--no); font-size: 13px; }
.ok { margin-top: 14px; padding: 9px 11px; border-left: 3px solid var(--ok); background: color-mix(in srgb, var(--ok) 8%, var(--surface)); color: var(--ok); font-size: 13px; }

/* ---------- App-Raster ---------- */
#app { display: grid; grid-template-columns: 272px 1fr; grid-template-rows: minmax(0, 1fr); height: 100vh; overflow: hidden; }
#app.rail-off { grid-template-columns: minmax(0, 1fr); }
#app.rail-off #rail { display: none; }

/* Menueband links */
#rail { background: var(--rail); color: var(--rail-fg); display: flex; flex-direction: column; min-height: 0; height: 100%; overflow: hidden; border-right: 1px solid var(--rail-line); }
#rail .head { padding: 15px 16px 13px; border-bottom: 1px solid var(--rail-line); }
#rail .head .name { font-weight: 700; color: var(--rail-fg); letter-spacing: -0.01em; font-size: 16px; }
#rail .head .ver { font-size: 11px; color: var(--rail-muted); margin-top: 2px; font-family: var(--font-mono); }
#rail .sec { padding: 14px 16px 6px; font-size: var(--label-fs); text-transform: var(--label-tf); letter-spacing: var(--label-tr); color: var(--rail-muted); display: flex; justify-content: space-between; align-items: center; }
#rail .sec button { background: none; border: 1px solid var(--rail-line); color: var(--rail-muted); padding: 1px 7px; font-size: 13px; line-height: 18px; }
#rail .sec button:hover { border-color: var(--accent); color: var(--accent); }
#rail .scroll { overflow: auto; flex: 1; min-height: 0; }
#rail .sec .secnav { cursor: pointer; }
#rail .sec .secnav:hover { color: var(--accent); }
.callist.navlist li { cursor: pointer; }
.callist.navlist li.active { background: var(--rail-active); border-left-color: var(--accent); font-weight: 600; }
.callist.navlist .cname { cursor: pointer; }
.callist { list-style: none; margin: 0; padding: 0 8px; }
.callist li { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-left: 2px solid transparent; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.callist li:hover { background: var(--rail-hover); border-left-color: var(--accent); }
/* Der Punkt ist ein Schalter: gefuellt = eingeblendet, hohl = ausgeblendet */
.callist .dot { width: 12px; height: 12px; flex: 0 0 12px; padding: 0; border: 2px solid var(--cal, var(--rail-line)); background: var(--cal, transparent); border-radius: 3px; }
.callist .dot.off { background: transparent; }
.callist .dot:hover { outline: 2px solid color-mix(in srgb, var(--cal, var(--accent)) 45%, transparent); outline-offset: 1px; }
.callist span.dot { border-radius: 3px; }
.callist .cname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; cursor: pointer; }
.callist .cname.off { opacity: .45; text-decoration: line-through; }
.callist .meta { font-size: 10px; color: var(--rail-muted); text-transform: uppercase; letter-spacing: .06em; }
.callist .cog { background: none; border: 0; color: var(--rail-muted); padding: 0 2px; }
.callist .cog:hover { color: var(--accent); }
#rail .foot { border-top: 1px solid var(--rail-line); padding: 12px 16px; }
#rail .foot .who { font-size: 13px; color: var(--ink); font-weight: 600; }
#rail .foot .role { font-size: 11px; color: var(--rail-muted); text-transform: uppercase; letter-spacing: .08em; }
#rail .foot .acts { display: flex; gap: 8px; margin-top: 10px; }
#rail .foot .acts button { flex: 1; background: none; border: 1px solid var(--rail-line); color: var(--ink-2); padding: 6px 4px; font-size: 12px; }
#rail .foot .acts button:hover { border-color: var(--accent); color: var(--accent); }
.pending-badge { display: inline-block; min-width: 18px; text-align: center; background: var(--warn); color: #fff; font-size: 11px; padding: 0 5px; margin-left: 6px; }

/* Hauptbereich */
#main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; overflow: hidden; background: var(--surface); }
.bar { display: flex; align-items: center; gap: 10px; padding: var(--bar-y) var(--bar-x); border-bottom: var(--border-w) solid var(--line); background: var(--surface); flex-wrap: wrap; box-shadow: var(--elev-1); }
.bar.hidden { display: none !important; }
.navbtn { border: var(--border-w) solid var(--line); background: var(--surface); color: var(--ink); padding: 6px 11px; border-radius: var(--radius-sm); }
.navbtn:hover { border-color: var(--accent); color: var(--accent); }
.railtoggle { font-size: 15px; line-height: 1; padding: 6px 10px; }
/* min-width 0 plus Ellipsis: sonst draengt der Titel den Aktionsknopf in eine zweite Zeile */
#title { font-size: 16px; font-weight: var(--head-weight); letter-spacing: var(--head-tracking); font-family: var(--font-head);
  min-width: 0; flex: 0 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewswitch { display: flex; border: var(--border-w) solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.viewswitch button { border: 0; background: var(--surface); color: var(--ink); padding: 6px 12px; white-space: nowrap; border-right: 1px solid var(--line); font-size: 13px; }
.viewswitch button:last-child { border-right: 0; }
.viewswitch button.active { background: var(--ink); color: var(--surface); }
.primary { background: var(--accent); color: var(--accent-ink); border: 0; padding: var(--btn-pad); font-weight: var(--btn-weight); border-radius: var(--radius-sm); }
.ghost { background: var(--surface); border: var(--border-w) solid var(--line); color: var(--ink); padding: var(--btn-pad); border-radius: var(--radius-sm); }
.ghost:hover { border-color: var(--accent); color: var(--accent); }
.danger { background: var(--surface); border: var(--border-w) solid var(--no); color: var(--no); padding: var(--btn-pad); border-radius: var(--radius-sm); }
.danger:hover { background: var(--no); color: #fff; }

#viewport { flex: 1; overflow: auto; min-height: 0; position: relative; }

/* ---------- Tages-/Wochenansicht ---------- */
.stickytop { position: sticky; top: 0; z-index: 6; background: var(--surface); }
.grid-head { display: grid; background: var(--surface); border-bottom: 1px solid var(--line); }
.grid-head .gutter { border-right: 1px solid var(--line); }
.grid-head .dh { padding: 5px 8px; border-right: 1px solid var(--line-2); text-align: left; display: flex; align-items: baseline; gap: 6px; }
.grid-head .dh .dow { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-2); }
.grid-head .dh .dnum { font-size: 13px; font-weight: 600; line-height: 1.2; color: var(--ink-2); }
.grid-head .dh.today .dow, .grid-head .dh.today .dnum { color: var(--accent); font-weight: 700; }
.grid-head .dh.today { background: var(--today-bg); }
.allday-row { display: grid; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.allday-row .gutter { border-right: 1px solid var(--line); font-size: 10px; color: var(--ink-2); padding: 4px 6px; text-transform: uppercase; letter-spacing: .06em; }
.allday-row .cell { border-right: 1px solid var(--line-2); padding: 3px; min-height: 26px; }
.timegrid { display: grid; position: relative; }
.timegrid .gutter { border-right: 1px solid var(--line); }
.timegrid .hourlabel { font-size: 11px; color: var(--ink); font-weight: 600; padding: 1px 7px 0 0; text-align: right; font-family: var(--font-mono); border-top: 1px solid var(--grid-hour); }
.timegrid .hourlabel:first-child { border-top-color: transparent; }
.daycol { position: relative; border-right: 1px solid var(--line-2); }
.daycol.today { background: var(--today-bg); }
.hourline { border-top: 1px solid var(--grid-hour); }
.hourline:first-child { border-top-color: transparent; }
.nowline { position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid #e0322f; z-index: 4; }
.nowline::before { content: ''; position: absolute; left: -4px; top: -4px; width: 6px; height: 6px; background: #e0322f; }

.ev {
  position: absolute; left: 2px; right: 3px; overflow: hidden;
  border-left: var(--ev-left) solid var(--accent); background: var(--surface);
  border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 2px 5px; font-size: 12px; line-height: 1.3; z-index: 2; cursor: pointer; color: var(--ink);
}
.ev:hover { z-index: 6; box-shadow: var(--elev-2); }
.ev .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev .h { font-family: var(--font-mono); font-size: 11px; color: var(--ink-2); }
/* Flache Bloecke zeigen nur den Titel, sonst wird die Zeit angeschnitten */
.ev.tiny { padding-top: 1px; padding-bottom: 0; }
.ev.tiny .h { display: none; }
.ev.tiny .t { font-size: 11.5px; }
.ev.pending { background: repeating-linear-gradient(135deg, var(--surface) 0 6px, color-mix(in srgb, var(--warn) 12%, var(--surface)) 6px 12px); }
.ev.declined { opacity: .5; text-decoration: line-through; }
.ev.tentative { border-style: dashed; }
.chip {
  display: block; width: 100%; text-align: left; border: 0; border-left: var(--ev-left) solid var(--accent); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--ink); padding: 2px 6px; font-size: 12px; margin-bottom: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip.pending { background: color-mix(in srgb, var(--warn) 12%, var(--surface)); }
.chip .h { font-family: var(--font-mono); color: var(--ink-2); margin-right: 5px; font-size: 11px; }

/* ---------- Monat ---------- */
.month { display: grid; grid-template-columns: repeat(7, 1fr); grid-template-rows: auto repeat(6, minmax(96px, 1fr)); min-height: 100%; }
.month .mh { position: sticky; top: 0; background: var(--surface); z-index: 3; padding: 6px 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); border-bottom: 1px solid var(--line); border-right: 1px solid var(--line-2); }
.mcell { border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); padding: var(--cell-pad); overflow: hidden; }
.mcell.out { background: var(--surface-2); color: var(--ink-2); }
.mcell.today { background: var(--today-bg); }
.mcell .d { font-size: 12px; font-weight: 700; margin-bottom: 3px; display: flex; justify-content: space-between; }
.mcell .d .add { border: 0; background: none; color: var(--ink-2); padding: 0 3px; visibility: hidden; }
.mcell:hover .d .add { visibility: visible; }
.mcell .more { font-size: 11px; color: var(--ink-2); padding-left: 6px; cursor: pointer; }

/* ---------- Jahr ---------- */
.year { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line-2); padding: 1px; }
.ymonth { background: var(--surface); padding: 10px 12px 12px; }
.ymonth h3 { margin: 0 0 8px; font-size: 13px; letter-spacing: .02em; }
.ymonth table { border-collapse: collapse; width: 100%; }
.ymonth th { font-size: 10px; color: var(--ink-2); font-weight: 500; padding-bottom: 3px; }
.ymonth td { text-align: center; padding: 0; }
.ymonth button { width: 100%; border: 0; background: none; color: var(--ink); font-size: 11px; padding: 3px 0 5px; position: relative; }
.ymonth button.out { color: var(--ink-2); opacity: .5; }
.ymonth button.today { background: var(--ink); color: var(--surface); }
.ymonth button.has::after { content: ''; position: absolute; left: 50%; transform: translateX(-50%); bottom: 1px; width: 4px; height: 4px; background: var(--accent); }
.ymonth button:hover { background: var(--line-2); }

/* ---------- Dialoge ---------- */
dialog { border: var(--border-w) solid var(--line); padding: 0; width: min(640px, 94vw); background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px var(--shadow); border-radius: var(--radius); overflow: hidden; }
dialog.wide { width: min(820px, 96vw); }
dialog::backdrop { background: rgba(8, 10, 14, .5); }
dialog .dhead { display: flex; align-items: center; justify-content: space-between; padding: 13px 18px; border-bottom: 1px solid var(--line); background: var(--ink); color: var(--surface); }
dialog .dhead h2 { margin: 0; font-size: 15px; letter-spacing: .01em; }
dialog .dhead button { background: none; border: 0; color: var(--surface); font-size: 18px; line-height: 1; }
dialog .dbody { padding: 18px; max-height: 68vh; overflow: auto; }
dialog .dfoot { display: flex; gap: 10px; align-items: center; padding: 13px 18px; border-top: 1px solid var(--line); background: var(--surface-2); }

/* ---------- Formularzeilen ---------- */
.row { display: grid; grid-template-columns: 190px 1fr; gap: 12px; align-items: center; margin-bottom: 11px; }
.row > label { font-size: var(--label-fs); text-transform: var(--label-tf); letter-spacing: var(--label-tr); color: var(--ink-2); }
.row input[type=text], .row input[type=email], .row input[type=password], .row input[type=url],
.row input[type=date], .row input[type=datetime-local], .row input[type=number], .row select, .row textarea {
  width: 100%; padding: 8px 9px;
}
.row textarea { min-height: 68px; resize: vertical; }
.row .inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
fieldset { border: var(--border-w) solid var(--line); margin: 0 0 16px; padding: 12px 14px; border-radius: var(--radius); }
legend { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-2); padding: 0 6px; }
.tabs { display: flex; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs button { border: 0; background: none; color: var(--ink); padding: 11px 16px; border-bottom: 2px solid transparent; font-size: 13px; }
.tabs button.active { border-bottom-color: var(--accent); font-weight: 600; }
.partlist { list-style: none; margin: 0; padding: 0; }
.partlist li { display: flex; align-items: center; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.badge { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; padding: 2px 6px; border: 1px solid var(--line); }
.badge.accepted { color: var(--ok); border-color: var(--ok); }
.badge.declined { color: var(--no); border-color: var(--no); }
.badge.pending { color: var(--warn); border-color: var(--warn); }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th { text-align: left; font-size: var(--label-fs); text-transform: var(--label-tf); letter-spacing: var(--label-tr); color: var(--ink-2); border-bottom: 1px solid var(--line); padding: 6px 8px; }
table.grid td { border-bottom: 1px solid var(--line-2); padding: 6px 8px; }
#toast { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
#toast div { background: var(--ink); color: var(--surface); padding: 10px 14px; font-size: 13px; border-left: 3px solid var(--accent); border-radius: var(--radius-sm); box-shadow: var(--elev-2); }
#toast div.bad { border-left-color: var(--no); }

/* ---------- Einstellungsseite ---------- */
.settings { display: grid; grid-template-columns: 230px minmax(0, 1fr); height: 100%; min-height: 0; }
.setnav { border-right: 1px solid var(--line); background: var(--surface-2); overflow: auto; padding: 10px 0; }
.setnav button { display: block; width: 100%; text-align: left; background: none; border: 0; border-left: 3px solid transparent; color: var(--ink); padding: 10px 16px; font-size: 13px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.setnav button:hover { background: var(--rail-hover); }
.setnav button.active { border-left-color: var(--accent); background: var(--rail-active); font-weight: 600; }
.setbody { overflow: auto; min-height: 0; padding: 24px 28px 60px; }
.setbody h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: var(--head-tracking); font-weight: var(--head-weight); font-family: var(--font-head); }
.setbody .lead { color: var(--ink-2); margin: 0 0 22px; max-width: 70ch; }
.setbody section { max-width: 900px; }
.copyfield { display: flex; gap: 8px; }
.copyfield input { flex: 1; padding: 8px 9px; font-family: var(--font-mono); font-size: 12px; }
.linkrow { display: grid; grid-template-columns: 1fr 2fr auto; gap: 8px; margin-bottom: 8px; }

/* Designvorlagen */
.themehead { display: flex; align-items: baseline; gap: 12px; margin: 22px 0 10px; }
.themehead h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-2); }
.themegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.themecard { border: 1px solid var(--line); background: var(--surface); padding: 0; text-align: left; overflow: hidden; border-radius: var(--radius-sm); }
.themecard:hover { border-color: var(--accent); }
.themecard.active { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.themecard .prev { display: grid; grid-template-columns: 34px 1fr; height: 70px; }
.themecard .prev .p-rail { border-right: 1px solid rgba(128,128,128,.25); }
.themecard .prev .p-main { display: flex; flex-direction: column; }
.themecard .prev .p-bar { height: 16px; border-bottom: 1px solid rgba(128,128,128,.25); }
.themecard .prev .p-body { flex: 1; position: relative; }
.themecard .prev .p-ev { position: absolute; left: 8px; right: 10px; top: 10px; height: 13px; border-left: 3px solid; }
.themecard .prev .p-ev2 { position: absolute; left: 18px; right: 22px; top: 30px; height: 13px; border-left: 3px solid; }
.themecard .lbl { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-top: 1px solid var(--line); font-size: 13px; }
.themecard .lbl .tag { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-2); }

/* ---------- CRM ---------- */
.crm { display: grid; grid-template-columns: 320px minmax(0, 1fr); height: 100%; min-height: 0; }
.crmlist { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.crmlist .search { padding: 10px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; }
.crmlist .search input { flex: 1; padding: 7px 9px; }
.crmlist ul { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; min-height: 0; }
.crmlist li { padding: 10px 12px; border-bottom: 1px solid var(--line-2); cursor: pointer; border-left: 3px solid transparent; }
.crmlist li:hover { background: var(--surface-2); }
.crmlist li.active { background: var(--today-bg); border-left-color: var(--accent); }
.crmlist .cn { font-weight: 600; }
.crmlist .cc { font-size: 12px; color: var(--ink-2); }
.crmdetail { overflow: auto; min-height: 0; padding: 20px 24px; }
.crmdetail h2 { margin: 0 0 2px; font-size: 22px; letter-spacing: var(--head-tracking); font-weight: var(--head-weight); font-family: var(--font-head); }
.crmdetail .sub { color: var(--ink-2); margin-bottom: 16px; }
.kpis { display: flex; gap: 26px; margin: 0 0 18px; padding: 12px 0; border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.kpi .n { font-size: 22px; font-weight: 700; line-height: 1.1; }
.kpi .l { font-size: var(--label-fs); text-transform: var(--label-tf); letter-spacing: var(--label-tr); color: var(--ink-2); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 9px 0 9px 16px; border-bottom: 1px solid var(--line-2); display: flex; gap: 14px; align-items: baseline; }
.timeline li .bar { position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; }
.timeline li.past { opacity: .62; }
.timeline .dt { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.timeline .ti { font-weight: 600; flex: 1; }
.timeline .meta { font-size: 12px; color: var(--ink-2); }
.notelist { list-style: none; margin: 0; padding: 0; }
.notelist li { border-left: 3px solid var(--line); padding: 8px 0 8px 12px; margin-bottom: 10px; }
.notelist .meta { font-size: 11px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .06em; }
.notelist .body { white-space: pre-wrap; margin-top: 3px; }
.detail dl { display: grid; grid-template-columns: 160px 1fr; gap: 8px 14px; margin: 0; }
.detail dt { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.detail dd { margin: 0; }
.detail .bigtitle { font-size: 21px; font-weight: var(--head-weight); letter-spacing: var(--head-tracking); margin: 0 0 4px; font-family: var(--font-head); }
.detail .when { font-family: var(--font-mono); color: var(--ink-2); margin-bottom: 16px; }
.detail .desc { white-space: pre-wrap; }
.reqlist { list-style: none; margin: 0; padding: 0; }
.reqlist li { border: 1px solid var(--line); border-left: 3px solid var(--warn); padding: 10px 12px; margin-bottom: 10px; }
.reqlist .hd { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.reqlist .nm { font-weight: 600; }
.reqlist .tm { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); }
.reqlist .acts { margin-top: 8px; display: flex; gap: 8px; align-items: center; }

/* Kleine Helfer in Tabellen */
.muted { color: var(--ink-2); font-size: 12px; }
.grid .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: baseline; }

/* ---------- Oeffentliche Mandantenseite ----------
   Grundgeruest. Die 20 Varianten in public.css setzen darauf auf. */
body.pub { background: var(--bg); color: var(--ink); }
body.pub .wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
body.pub .hidden { display: none !important; }

#pubHead { background: var(--ink); color: var(--surface); border-bottom: 3px solid var(--accent); }
#pubHead .wrap { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 40px 24px 34px; flex-wrap: wrap; }
#pubHead h1 { margin: 0; font-size: 34px; letter-spacing: -0.02em; line-height: 1.15; }
#pubHead p { margin: 8px 0 0; color: color-mix(in srgb, var(--surface) 68%, var(--ink)); max-width: 62ch; }
#pubLinks { display: flex; gap: 18px; flex-wrap: wrap; }
#pubLinks a { color: color-mix(in srgb, var(--surface) 82%, var(--ink)); text-decoration: none; font-size: 13px; text-transform: uppercase; letter-spacing: .07em; border-bottom: 1px solid transparent; padding-bottom: 2px; }
#pubLinks a:hover { color: var(--surface); border-bottom-color: var(--accent); }

body.pub .pubgrid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; padding: 32px 24px 56px; }
.pubcol { min-width: 0; }
.pubside { position: sticky; top: 24px; }

.lead { font-size: 16px; line-height: 1.65; color: var(--ink-2); margin: 0 0 26px; max-width: 68ch; }
.hint { color: var(--ink-2); font-size: 13px; }

.step { background: var(--surface); border: var(--border-w) solid var(--line); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 20px; box-shadow: var(--elev-1); }
.stephead { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; }
.stephead h2 { margin: 0; font-size: 16px; font-family: var(--font-head); letter-spacing: -0.01em; }
.stephead .num {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
}

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.card {
  position: relative; text-align: left; display: block; cursor: pointer;
  background: var(--surface); color: var(--ink);
  border: var(--border-w) solid var(--line); border-radius: var(--radius);
  padding: 14px 16px 14px 20px;
}
.card:hover { border-color: var(--accent); }
.card.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.card .cbar { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; border-radius: var(--radius) 0 0 var(--radius); }
.card .nm { display: block; font-weight: 600; }
.card .ds { display: block; font-size: 13px; color: var(--ink-2); margin-top: 4px; line-height: 1.45; }
.card .meta { display: flex; gap: 12px; align-items: baseline; margin-top: 10px; }
.card .dur { font-size: 12px; color: var(--ink-2); }
.card .prc { font-size: 13px; font-weight: 600; }
.card .tag { display: inline-block; margin-top: 10px; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; border: 1px solid var(--accent); color: var(--accent); padding: 1px 7px; border-radius: var(--radius-pill); }

.daypick { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.daypick input { padding: 9px 12px; }
.slots { display: flex; flex-wrap: wrap; gap: 8px; }
.slot { border: var(--border-w) solid var(--line); background: var(--surface); color: var(--ink); padding: 9px 15px; font-family: var(--font-mono); font-size: 13px; border-radius: var(--radius-pill); cursor: pointer; }
.slot:hover { border-color: var(--accent); color: var(--accent); }
.slot.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.chosen { background: color-mix(in srgb, var(--accent) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: var(--radius-sm); padding: 11px 14px; margin-bottom: 18px; font-size: 14px; }
.fieldrow { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-2); margin-bottom: 5px; }
.field input, .field textarea { width: 100%; padding: 10px 12px; }
.privacy { font-size: 12px; line-height: 1.55; color: var(--ink-2); margin: 4px 0 18px; }
#bkForm button.primary { padding: 12px 26px; }

.weeknav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.weeknav span { font-weight: 600; font-size: 14px; }
.ghost.wide { width: 100%; margin-bottom: 14px; }

.agday { display: grid; grid-template-columns: 74px 1fr; border-top: 1px solid var(--line-2); }
.agday:first-child { border-top: 0; }
.agd { padding: 9px 10px 9px 0; }
.agd .dw { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); }
.agd .dn { font-size: 15px; font-weight: 700; }
.agl { padding: 9px 0; }
.agitem { position: relative; display: flex; gap: 8px; align-items: baseline; padding: 4px 0 4px 12px; flex-wrap: wrap; }
.agitem .cbar { position: absolute; left: 0; top: 5px; bottom: 5px; width: 3px; }
.agitem .tm { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.agitem .tt { font-weight: 600; font-size: 14px; }
.agitem .lo { font-size: 12px; color: var(--ink-2); }
.agfree { padding: 4px 0 4px 12px; color: var(--ink-2); opacity: .6; font-size: 13px; }

.note { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; font-size: 13px; color: var(--ink-2); line-height: 1.55; }

#pubFoot { border-top: 1px solid var(--line); background: var(--surface); margin-top: 20px; }
#pubFoot .wrap { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; padding-top: 20px; padding-bottom: 20px; }
#pubFoot .legal { border: 0; padding: 0; }
#pubFoot .by { font-size: 12px; color: var(--ink-2); }

#pubError { padding: 90px 24px; text-align: center; }
#pubError h1 { font-size: 24px; margin: 0 0 8px; }
#pubError p { color: var(--ink-2); }

@media (max-width: 960px) {
  body.pub .pubgrid { grid-template-columns: 1fr; }
  .pubside { position: static; }
  .fieldrow { grid-template-columns: 1fr; }
  #pubHead h1 { font-size: 26px; }
}


@media (max-width: 1000px) { .crm, .settings { grid-template-columns: 1fr; } .crmlist, .setnav { display: none; } }
@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; }
  #rail { display: none; }
  #login { grid-template-columns: 1fr; }
  #login .brandpane { display: none; }
}

/* Die Aktionsknoepfe duerfen nie umbrechen */
.bar .primary, .bar .ghost, .bar .navbtn { white-space: nowrap; flex: 0 0 auto; }
.bar select { flex: 0 1 auto; min-width: 0; }

/* ---------- Support-Lesesitzung ---------- */
#supportBanner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 16px; background: #7a4a06; color: #fff; font-size: 13px;
}
#supportBanner strong { text-transform: uppercase; letter-spacing: .07em; font-size: 11px; }
#supportBanner button { margin-left: auto; background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.4); padding: 4px 12px; border-radius: var(--radius-sm); font-size: 12px; }
#app.readonly .bar > button.primary, #app.readonly #btnNewEvent { display: none; }
