/* =====================================================================
   Tabnest Design-System
   Ein Satz semantischer Tokens (wie shadcn/ui). Themes ändern nur Tokens,
   Komponenten lesen nur Tokens. Raster: 4 px. Höhen: 28 / 32 / 36 / 40.
   ===================================================================== */
:root {
  --font-ui: var(--ui-font, "Geist", system-ui, -apple-system, "Segoe UI", sans-serif);
  --font-display: var(--clock-font, "Geist", system-ui, sans-serif);
  --font-mono: "Geist Mono", ui-monospace, monospace;

  /* Abstände */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px; --s12: 48px;
  /* Höhen */
  --h-xs: 24px; --h-sm: 28px; --h-md: 32px; --h-lg: 36px; --h-xl: 40px;
  /* Radien: aus einem Wert abgeleitet */
  --radius: var(--r, 14px);
  --radius-lg: var(--radius);
  --radius-md: max(4px, calc(var(--radius) - 4px));
  --radius-sm: max(3px, calc(var(--radius) - 7px));
  --radius-full: 999px;
  /* Bewegung */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --dur-1: 120ms; --dur-2: 200ms; --dur-3: 320ms;
  /* Typo */
  --text-xs: 11px; --text-sm: 12.5px; --text-md: 13.5px; --text-lg: 15px;
}

/* ---------- Themes: nur Tokens ---------- */
body[data-theme="paper"] { --background:#fafafa; --foreground:#0a0a0a; --card:#ffffff; --popover:#ffffff; --muted:#f1f1f1; --muted-foreground:#6b6b6b; --subtle:#9b9b9b; --border:#e6e6e6; --input:#d4d4d4; --primary-default:#0a0a0a; --on-primary:#fff; --scrim:rgba(10,10,10,.28); }
body[data-theme="sand"]  { --background:#ece4d6; --foreground:#2a2117; --card:#f8f3ea; --popover:#faf6ef; --muted:#efe7d8; --muted-foreground:#6e604c; --subtle:#9a8c75; --border:#dcd1bd; --input:#cdbfa7; --primary-default:#c2410c; --on-primary:#fff; --scrim:rgba(42,33,23,.3); }
body[data-theme="sky"]   { --background:#e6edf7; --foreground:#141b26; --card:#fbfcfe; --popover:#fbfcfe; --muted:#edf2f9; --muted-foreground:#56637a; --subtle:#8592a6; --border:#d6dfed; --input:#c3cfe2; --primary-default:#2f6fed; --on-primary:#fff; --scrim:rgba(20,27,38,.28); }
body[data-theme="moss"]  { --background:#16231d; --foreground:#eef1ea; --card:#1d2c25; --popover:#22332b; --muted:#25362e; --muted-foreground:#a3b3a8; --subtle:#748a7d; --border:#2c3e35; --input:#3a4f44; --primary-default:#ffd23f; --on-primary:#16231d; --scrim:rgba(0,0,0,.5); }
body[data-theme="ink"]   { --background:#111110; --foreground:#efece6; --card:#191917; --popover:#1f1e1c; --muted:#232220; --muted-foreground:#a39e94; --subtle:#75716a; --border:#2a2926; --input:#3a3834; --primary-default:#ff5a2c; --on-primary:#fff; --scrim:rgba(0,0,0,.55); }
body[data-theme="night"] { --background:#0d1117; --foreground:#e8edf4; --card:#141a23; --popover:#19212c; --muted:#1c2430; --muted-foreground:#97a3b4; --subtle:#687587; --border:#232c39; --input:#323e4f; --primary-default:#7aa2ff; --on-primary:#0d1117; --scrim:rgba(0,0,0,.55); }
body { --primary: var(--primary-override, var(--primary-default)); --ring: color-mix(in srgb, var(--primary) 55%, transparent); --destructive: #e5484d; }

/* Schatten-Stufen (Einstellung „Schatten“) */
body { --shadow-sm: 0 1px 2px rgb(0 0 0 / .04); --shadow-md: 0 1px 2px rgb(0 0 0 / .04), 0 4px 12px -6px rgb(0 0 0 / .08); --shadow-lg: 0 16px 48px -12px rgb(0 0 0 / .28), 0 0 0 1px var(--border); }
body.shadow-flat { --shadow-sm: none; --shadow-md: none; }
body.shadow-float { --shadow-sm: 0 2px 6px rgb(0 0 0 / .06); --shadow-md: 0 2px 6px rgb(0 0 0 / .05), 0 18px 40px -18px rgb(0 0 0 / .3); }
body[data-theme="moss"], body[data-theme="ink"], body[data-theme="night"] { --shadow-lg: 0 24px 60px -12px rgb(0 0 0 / .7), 0 0 0 1px var(--border); }

/* ---------- Basis ---------- */
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; font: 400 var(--text-md)/1.45 var(--font-ui); color: var(--foreground); background: var(--background); -webkit-font-smoothing: antialiased; transition: background-color .5s var(--ease), color var(--dur-3); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
input, textarea { font: inherit; color: inherit; }
a { color: inherit; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: var(--radius-sm); }
::selection { background: color-mix(in srgb, var(--primary) 26%, transparent); }
.i { display: inline-grid; place-items: center; width: 16px; height: 16px; flex-shrink: 0; }
.i svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 var(--s1); font: 500 10.5px var(--font-mono); color: var(--muted-foreground); background: var(--muted); border-radius: 5px; box-shadow: inset 0 0 0 1px var(--border); white-space: nowrap; }
.meta { margin-left: auto; color: var(--muted-foreground); font: 500 var(--text-xs) var(--font-mono); white-space: nowrap; }

/* Hintergrundbild / Verlauf */
#wall { position: fixed; inset: 0; z-index: -1; background-size: cover; background-position: center; opacity: 0; transition: opacity .6s var(--ease); }
body.has-wall #wall, body.has-grad #wall { opacity: 1; }
body.has-grad #wall { background-color: var(--background); }
body.has-wall #wall::after { content: ""; position: absolute; inset: 0; background: color-mix(in srgb, var(--background) 30%, transparent); }

/* ---------- Bausteine ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); height: var(--h-md); padding: 0 var(--s3); border-radius: var(--radius-md); font-weight: 500; font-size: var(--text-sm); color: var(--foreground); background: var(--card); box-shadow: inset 0 0 0 1px var(--input); transition: background var(--dur-1), opacity var(--dur-1), transform var(--dur-1); white-space: nowrap; }
.btn:hover { background: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn.pri { background: var(--foreground); color: var(--background); box-shadow: none; } .btn.pri:hover { opacity: .88; }
.btn.lg { height: var(--h-xl); padding: 0 var(--s4); font-size: var(--text-md); }
.ib { position: relative; display: grid; place-items: center; width: var(--h-md); height: var(--h-md); border-radius: var(--radius-md); color: var(--muted-foreground); transition: color var(--dur-1), background var(--dur-1); }
.ib:hover, .ib.on { color: var(--foreground); background: var(--muted); }
.ib.sm { width: var(--h-sm); height: var(--h-sm); border-radius: var(--radius-sm); } .ib.sm .i { width: 15px; height: 15px; }
.ib.danger:hover { color: var(--destructive); }
.field { width: 100%; height: var(--h-md); padding: 0 var(--s3); border: 0; border-radius: var(--radius-md); background: var(--card); box-shadow: inset 0 0 0 1px var(--input); transition: box-shadow var(--dur-1); }
.field:focus { box-shadow: inset 0 0 0 1px var(--primary), 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.field::placeholder { color: var(--subtle); }
.field:disabled { opacity: .55; cursor: not-allowed; }
.hint { margin-right: auto; color: var(--muted-foreground); font-size: var(--text-xs); }
.hint.bad { color: var(--destructive); }
.pro-tag, .lk { display: inline-block; font: 600 9.5px/1.6 var(--font-mono); letter-spacing: .05em; padding: 0 5px; border-radius: 4px; background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--primary); vertical-align: 1px; }
.pro-tag { background: var(--primary); color: var(--on-primary); }
.empty { padding: var(--s2) var(--s2) var(--s3); color: var(--muted-foreground); font-size: var(--text-sm); }
.empty.big { grid-column: 1 / -1; text-align: center; padding: var(--s10); }
.tip { margin: var(--s3) 0 0; color: var(--muted-foreground); font-size: var(--text-sm); }

/* ---------- Kopfzeile ---------- */
.top { position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 1fr minmax(240px, 520px) 1fr; align-items: center; gap: var(--s4); height: 60px; padding: 0 var(--s6); transition: background var(--dur-2), box-shadow var(--dur-2); }
.top.scrolled { background: color-mix(in srgb, var(--background) 86%, transparent); backdrop-filter: blur(14px) saturate(140%); box-shadow: 0 1px 0 var(--border); }
.top-l { display: flex; align-items: center; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.top-r { display: flex; align-items: center; justify-content: flex-end; gap: var(--s1); }
.ws { position: relative; display: inline-flex; align-items: center; gap: 6px; height: var(--h-md); padding: 0 var(--s3); border-radius: var(--radius-md); color: var(--muted-foreground); font-weight: 500; white-space: nowrap; transition: color var(--dur-1), background var(--dur-1), box-shadow var(--dur-1); }
.ws:hover { color: var(--foreground); background: var(--muted); }
.ws.on { color: var(--foreground); background: var(--card); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.ws .ws-i { display: inline-grid; } .ws .ws-i .i { width: 14px; height: 14px; }
.ws-dot { width: 8px; height: 8px; border-radius: 50%; }
.ws.drop-into { box-shadow: 0 0 0 2px var(--primary); color: var(--foreground); }
.ws.drop-before::before, .ws.drop-after::after { content: ""; position: absolute; top: 6px; bottom: 6px; width: 2px; border-radius: 2px; background: var(--primary); }
.ws.drop-before::before { left: -2px; } .ws.drop-after::after { right: -2px; }
.dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 2px var(--background); }
.avatar { display: grid; place-items: center; width: var(--h-md); height: var(--h-md); margin-left: var(--s1); border-radius: 50%; font-weight: 600; font-size: var(--text-xs); color: var(--muted-foreground); background: var(--muted); box-shadow: 0 0 0 1px var(--border); transition: color var(--dur-1), box-shadow var(--dur-1); }
.avatar:hover { color: var(--foreground); box-shadow: 0 0 0 1px var(--input); }
.avatar.in { background: var(--foreground); color: var(--background); box-shadow: none; }
.search { display: flex; align-items: center; gap: var(--s2); height: var(--h-xl); padding: 0 var(--s2) 0 var(--s3); border-radius: var(--radius-md); background: var(--card); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); color: var(--subtle); cursor: text; transition: box-shadow var(--dur-2); }
.search:focus-within { box-shadow: 0 0 0 1px var(--input), 0 0 0 4px color-mix(in srgb, var(--primary) 14%, transparent); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; color: var(--foreground); }
.search input::placeholder { color: var(--subtle); }
body.no-search .search { visibility: hidden; }

/* ---------- Uhr ---------- */
.hero { max-width: var(--page-w, 1340px); margin: 0 auto; padding: var(--s10) var(--s6); text-align: center; user-select: none; }
.clock { font: 400 var(--clock-size, 96px)/1 var(--font-display); letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.greet { margin-top: var(--s3); color: var(--muted-foreground); font-size: var(--text-md); }
.greet b { color: var(--foreground); font-weight: 500; }
body.clock-left .hero { text-align: left; }
body.no-greet .greet { display: none; }
body.no-clock .hero { display: none; }
body.no-clock .board { padding-top: var(--s6); }

/* ---------- Board ---------- */
.board { max-width: var(--page-w, 1340px); margin: 0 auto; padding: 0 var(--s6) var(--s12); display: grid; grid-template-columns: var(--cols, repeat(auto-fill, minmax(272px, 1fr))); gap: var(--s4); align-items: start; }

/* Karte */
.card { position: relative; background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--shadow-md), 0 0 0 1px var(--border); transition: box-shadow var(--dur-2), opacity var(--dur-2), background .5s; animation: rise .45s var(--ease) both; animation-delay: calc(var(--n, 0) * 28ms); }
.card.wide { grid-column: span 2; }
body.shadow-float .card:hover { box-shadow: 0 4px 10px rgb(0 0 0 / .06), 0 24px 48px -20px rgb(0 0 0 / .32), 0 0 0 1px var(--border); }
.card.dragging { opacity: .4; }
.card.drop-before::before, .card.drop-after::after { content: ""; position: absolute; top: var(--s2); bottom: var(--s2); width: 3px; border-radius: 3px; background: var(--primary); }
.card.drop-before::before { left: -10px; } .card.drop-after::after { right: -10px; }
.card.drop-into { box-shadow: 0 0 0 2px var(--primary), var(--shadow-md); }
.card-h { display: flex; align-items: center; gap: var(--s2); height: 44px; padding: 0 var(--s2) 0 13px; cursor: grab; } /* Symbol fluchtet mit den Favicons darunter */
.card-h:active { cursor: grabbing; }
.card-ic { display: grid; place-items: center; width: 24px; height: 24px; margin-left: 0; border-radius: var(--radius-sm); color: var(--muted-foreground); transition: background var(--dur-1), color var(--dur-1); }
.card-ic:hover { background: var(--muted); color: var(--foreground); }
.card-ic .i { width: 15px; height: 15px; }
.card.tinted .card-ic { color: var(--tint); background: color-mix(in srgb, var(--tint) 14%, transparent); }
.card-t { margin: 0; min-width: 0; font-size: var(--text-md); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: inherit; }
.card-t-in { flex: 1; min-width: 0; height: var(--h-sm); padding: 0 var(--s2); margin-left: -6px; font-weight: 600; font-size: var(--text-md); border: 0; border-radius: var(--radius-sm); background: var(--muted); box-shadow: inset 0 0 0 1px var(--input); }
.card-n { color: var(--muted-foreground); font: 500 var(--text-xs) var(--font-mono); }
.card-a { display: flex; gap: 2px; margin-left: auto; opacity: 0; transition: opacity var(--dur-1); }
.card:hover .card-a, .card:focus-within .card-a, .card-a.keep { opacity: 1; }
.card-b { padding: 0 var(--s2) var(--s2); min-height: var(--s2); }
.card.collapsed .card-b { display: none; }

/* Notiz-Karte */
.note-card.tinted { background: color-mix(in srgb, var(--tint) 13%, var(--card)); box-shadow: var(--shadow-md), 0 0 0 1px color-mix(in srgb, var(--tint) 26%, var(--border)); }
.note-card .card-b { padding: 0 var(--s4) var(--s4) 14px; }
.note-card textarea { display: block; width: 100%; min-height: 108px; padding: 0; border: 0; resize: none; background: transparent; font: 400 var(--text-lg)/1.55 var(--font-ui); color: var(--foreground); field-sizing: content; }
.note-card textarea::placeholder { color: var(--subtle); }

/* Zeilen */
.row { position: relative; display: flex; align-items: center; gap: var(--s3); height: var(--row-h, 36px); padding: 0 6px 0 var(--s2); border-radius: var(--radius-md); color: var(--foreground); text-decoration: none; transition: background var(--dur-1); }
.row:hover, .row:focus-visible { background: var(--muted); outline-offset: -2px; }
.row.dragging { opacity: .35; }
.row.drop-before::before, .row.drop-after::after { content: ""; position: absolute; left: var(--s2); right: var(--s2); height: 2px; border-radius: 2px; background: var(--primary); }
.row.drop-before::before { top: -1px; } .row.drop-after::after { bottom: -1px; }
.row-t { flex: 0 1 auto; min-width: 0; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-d { flex: 1 1 0; min-width: 0; color: var(--muted-foreground); font-size: var(--text-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity var(--dur-1); }
.row-a { display: none; gap: 1px; margin-left: auto; }
.row:hover .row-a, .row:focus-within .row-a { display: flex; }
.row:hover .row-d { opacity: 0; }
.bell { display: inline-grid; color: var(--primary); } .bell .i { width: 13px; height: 13px; }
.row.dr { cursor: grab; }

/* Favicon mit Buchstaben-Fallback */
.fav { position: relative; display: grid; place-items: center; flex-shrink: 0; border-radius: 5px; overflow: hidden; background: var(--tone); color: #fff; font-weight: 600; line-height: 1; }
.fav img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; }
.fav.has-img { background: transparent; } .fav.has-img img { opacity: 1; } .fav.has-img b { visibility: hidden; }
body.fav-mono .fav img { filter: grayscale(1) contrast(1.05); } body.fav-mono .fav:not(.has-img) { background: var(--muted-foreground); }
body.no-fav .board .fav { display: none; }
body.no-domain .row-d { display: none; }
body.no-counts .card-n { display: none; }

/* Kachel-Ansicht */
.card-b.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: var(--s1); }
.tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: var(--s2) var(--s1) 6px; border-radius: var(--radius-md); text-decoration: none; color: var(--foreground); transition: background var(--dur-1); }
.tile:hover, .tile:focus-visible { background: var(--muted); }
.tile-i { display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--radius-md); background: var(--card); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); transition: transform var(--dur-2) var(--ease); }
.tile:hover .tile-i { transform: translateY(-2px); }
.tile-t { width: 100%; text-align: center; font-size: var(--text-xs); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-a { position: absolute; top: 2px; right: 2px; opacity: 0; transition: opacity var(--dur-1); } .tile:hover .tile-a, .tile:focus-within .tile-a { opacity: 1; }
.tile .bell { position: absolute; top: 6px; left: 8px; }
.tile.dragging { opacity: .35; }
.tile.drop-before::before, .tile.drop-after::after { content: ""; position: absolute; top: var(--s2); bottom: var(--s2); width: 2px; border-radius: 2px; background: var(--primary); }
.tile.drop-before::before { left: -2px; } .tile.drop-after::after { right: -2px; }
.add-t { color: var(--muted-foreground); } .add-t > .i { width: 44px; height: 44px; padding: 13px; border-radius: var(--radius-md); box-shadow: inset 0 0 0 1px var(--border); } .add-t span { font-size: var(--text-xs); }
.add-t:hover { color: var(--foreground); }

.add { display: flex; align-items: center; gap: var(--s3); width: 100%; height: calc(var(--row-h, 36px) - 2px); padding: 0 var(--s2); border-radius: var(--radius-md); color: var(--muted-foreground); font-size: var(--text-sm); transition: color var(--dur-1), background var(--dur-1); }
.add:hover { color: var(--foreground); background: var(--muted); }
.add .i { width: 18px; }

/* Inline-Formular */
.edit { display: grid; gap: 6px; padding: var(--s2); margin: 2px 0; border-radius: var(--radius-md); background: var(--muted); box-shadow: inset 0 0 0 1px var(--border); animation: rise .2s var(--ease) both; grid-column: 1 / -1; }
.edit-f { display: flex; align-items: center; gap: 6px; margin-top: 2px; }

/* Neuer Bereich / Ablagefläche */
.new-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--s2); min-height: 96px; padding: var(--s4); border-radius: var(--radius-lg); box-shadow: inset 0 0 0 1px var(--border); transition: box-shadow var(--dur-2), background var(--dur-2); }
.new-card:hover { box-shadow: inset 0 0 0 1px var(--input); }
.nc-b { display: inline-flex; align-items: center; gap: 6px; height: var(--h-md); padding: 0 var(--s3); border-radius: var(--radius-md); color: var(--muted-foreground); font-weight: 500; transition: color var(--dur-1), background var(--dur-1); }
.nc-b:hover { color: var(--foreground); background: var(--muted); }
.nc-hint { width: 100%; text-align: center; color: var(--subtle); font-size: var(--text-xs); opacity: 0; transition: opacity var(--dur-2); }
body.is-dragging .nc-hint { opacity: 1; }
.board.drop-new .new-card { box-shadow: inset 0 0 0 2px var(--primary); background: color-mix(in srgb, var(--primary) 6%, transparent); }

/* Willkommen */
.welcome { grid-column: 1 / -1; padding: var(--s8); text-align: center; }
.welcome h2 { margin: 0 0 var(--s2); font: 400 34px/1.1 var(--font-display); letter-spacing: -.02em; }
.welcome p { margin: 0 auto var(--s5); max-width: 440px; color: var(--muted-foreground); }
.welcome .acts { display: flex; gap: var(--s2); justify-content: center; flex-wrap: wrap; }

/* Kartenstile */
body.style-outline .card:not(.tinted) { background: transparent; box-shadow: inset 0 0 0 1px var(--input); }
body.style-glass .card { background: color-mix(in srgb, var(--card) 58%, transparent); backdrop-filter: blur(18px) saturate(160%); -webkit-backdrop-filter: blur(18px) saturate(160%); box-shadow: inset 0 1px 0 rgb(255 255 255 / .08), 0 0 0 1px color-mix(in srgb, var(--border) 70%, transparent), 0 10px 30px -16px rgb(0 0 0 / .25); }
body.has-wall .top.scrolled, body.has-grad .top.scrolled { background: color-mix(in srgb, var(--background) 62%, transparent); }

/* ---------- Seitenleiste ---------- */
.drawer { position: fixed; z-index: 25; top: 64px; right: var(--s3); bottom: var(--s3); width: 344px; display: flex; flex-direction: column; background: var(--popover); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); transform: translateX(calc(100% + var(--s6))); visibility: hidden; transition: transform var(--dur-3) var(--ease), visibility 0s linear var(--dur-3); }
.drawer.open { transform: none; visibility: visible; transition: transform var(--dur-3) var(--ease), visibility 0s; } /* zu: unsichtbar, sonst ragt der Schatten in den Rand */
.seg, .segc, .tabs-h { display: flex; gap: 2px; padding: 3px; border-radius: var(--radius-md); background: var(--muted); }
.seg { margin: var(--s3) var(--s3) var(--s1); }
.seg button, .segc button, .tabs-h button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--h-sm); padding: 0 var(--s2); border-radius: max(3px, calc(var(--radius-md) - 2px)); font-weight: 500; font-size: var(--text-sm); color: var(--muted-foreground); white-space: nowrap; transition: color var(--dur-1), background var(--dur-1), box-shadow var(--dur-1); }
.seg button:hover, .segc button:hover, .tabs-h button:hover { color: var(--foreground); }
.seg button.on, .segc button.on, .tabs-h button.on { background: var(--card); color: var(--foreground); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.drawer-b { flex: 1; overflow: auto; padding: var(--s2); }
.drawer-f { display: flex; gap: var(--s2); padding: var(--s3); border-top: 1px solid var(--border); }
.drawer-f .btn { flex: 1; }
.sess { padding: var(--s3); border-radius: var(--radius-md); margin-bottom: var(--s1); cursor: grab; transition: background var(--dur-1); }
.sess:hover { background: var(--muted); }
.sess-h { display: flex; align-items: center; gap: var(--s2); }
.sess-t { font-weight: 600; font-size: var(--text-md); }
.sess-favs { display: flex; flex-wrap: wrap; gap: var(--s1); margin-top: var(--s2); }
.sess-a { display: flex; gap: 6px; margin-top: var(--s3); }
.sess-a .btn { height: var(--h-sm); font-size: var(--text-xs); padding: 0 var(--s3); }

/* ---------- Überlagerungen ---------- */
#layer { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
#layer > * { pointer-events: auto; }
.shield { position: fixed; inset: 0; }
.scrim { position: fixed; inset: 0; background: var(--scrim); backdrop-filter: blur(3px); animation: fade var(--dur-2) both; }
.pop { position: fixed; min-width: 220px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); overflow: auto; padding: var(--s1); border-radius: var(--radius-lg); background: var(--popover); box-shadow: var(--shadow-lg); animation: pop .16s var(--ease) both; transform-origin: top left; }
.pop.wide-pop { width: 320px; }
.mi { display: flex; align-items: center; gap: var(--s3); width: 100%; height: var(--h-md); padding: 0 var(--s3); border-radius: var(--radius-md); font-size: var(--text-md); color: var(--foreground); text-align: left; }
.mi:hover, .mi:focus-visible, .mi.kb { background: var(--muted); outline: none; }
.mi .i { color: var(--muted-foreground); }
.mi-t { flex: 0 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Menüpunkt mit Beschreibung darunter (Widget-Menü): Name wird nie abgeschnitten */
.mi:has(.mi-sub) { height: auto; min-height: var(--h-md); padding-block: 7px; }
.mi:has(.mi-sub) .mi-t { flex: 1; white-space: normal; }
.mi-sub { display: block; margin-top: 1px; font-size: var(--text-sm); color: var(--muted-foreground); }
.mi.danger, .mi.danger .i { color: var(--destructive); }
.mi kbd { margin-left: auto; }
.sep { height: 1px; margin: var(--s1) var(--s2); background: var(--border); }
.mh { padding: var(--s2) var(--s3) var(--s1); font: 500 10.5px var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted-foreground); }
.pp { padding: var(--s1) var(--s2) var(--s2); }
.dots { display: flex; flex-wrap: wrap; gap: var(--s2); }
.dt { position: relative; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--muted); box-shadow: inset 0 0 0 1px rgb(0 0 0 / .08); font: 600 var(--text-xs) var(--font-ui); color: var(--muted-foreground); transition: transform var(--dur-2) var(--ease); }
.dots.sm { gap: 6px; } .dots.sm .dt { width: 22px; height: 22px; } .dots.sm .dt .i { width: 12px; height: 12px; }
.dt:hover { transform: scale(1.1); }
.dt.on { box-shadow: 0 0 0 2px var(--popover), 0 0 0 4px var(--foreground); }
.dt.locked::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 11px; height: 11px; border-radius: 50%; background: var(--popover) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='3' stroke-linecap='round'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E") center/7px no-repeat; box-shadow: 0 0 0 1px var(--border); }
.icons { display: grid; grid-template-columns: repeat(9, 1fr); gap: 2px; }
.ic-b { display: grid; place-items: center; aspect-ratio: 1; border-radius: var(--radius-sm); color: var(--muted-foreground); transition: background var(--dur-1), color var(--dur-1); }
.ic-b:hover { background: var(--muted); color: var(--foreground); }
.ic-b.on { background: var(--foreground); color: var(--background); }
.ic-b .i { width: 15px; height: 15px; }

/* Dialog */
.dialog { position: fixed; left: 50%; top: 12vh; width: min(440px, calc(100vw - 32px)); max-height: 80vh; padding: var(--s6); border-radius: calc(var(--radius-lg) + 4px); background: var(--popover); box-shadow: var(--shadow-lg); transform: translateX(-50%); animation: dpop .2s var(--ease) both; display: flex; flex-direction: column; }
.dialog.wide { width: min(620px, calc(100vw - 32px)); top: 7vh; max-height: 86vh; }
.dialog.noanim { animation: none; }
.dialog h3 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.dialog .acts { display: flex; justify-content: flex-end; gap: var(--s2); margin-top: var(--s4); }
.dialog label.l { display: grid; gap: 6px; margin: var(--s3) 0 0; font-size: var(--text-sm); font-weight: 500; color: var(--muted-foreground); }
.dialog .field { height: var(--h-lg); }
.dialog .err { min-height: 18px; margin-top: var(--s2); color: var(--destructive); font-size: var(--text-sm); }
.set-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.tabs-h { margin: var(--s4) 0 var(--s2); }
.set-body { flex: 1; min-height: 0; overflow: auto; margin: 0 calc(var(--s6) * -1); padding: 0 var(--s6) var(--s1); scrollbar-width: thin; }
.grp { padding: var(--s4) 0; border-top: 1px solid var(--border); }
.grp:first-child { border-top: 0; padding-top: var(--s2); }
.grp-l { display: flex; align-items: center; gap: 6px; margin-bottom: var(--s3); font-size: var(--text-sm); font-weight: 600; color: var(--foreground); }
.set-row { display: flex; align-items: center; gap: var(--s3); min-height: var(--h-xl); }
.set-row > span { flex: 1; }
.set-row small { display: block; color: var(--muted-foreground); font-size: var(--text-xs); }
.sw-t { position: relative; flex-shrink: 0; width: 36px; height: 20px; border-radius: var(--radius-full); background: var(--input); transition: background var(--dur-2); }
.sw-t::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .25); transition: transform var(--dur-2) var(--ease); }
.sw-t.on { background: var(--foreground); } .sw-t.on::after { transform: translateX(16px); }
body[data-theme="moss"] .sw-t.on::after, body[data-theme="ink"] .sw-t.on::after, body[data-theme="night"] .sw-t.on::after { background: var(--background); }
.swatches, .sw-l { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--s2); }
.sw { position: relative; aspect-ratio: 1.3; border-radius: var(--radius-md); box-shadow: inset 0 0 0 1px rgb(0 0 0 / .08); overflow: hidden; transition: transform var(--dur-2) var(--ease); }
.sw:hover { transform: translateY(-2px); }
.sw i { position: absolute; inset: 30% 22%; border-radius: 4px; }
.sw.on { box-shadow: 0 0 0 2px var(--popover), 0 0 0 4px var(--foreground); }
.sw-l { margin-top: 6px; font-size: var(--text-xs); color: var(--muted-foreground); text-align: center; }
.bgs { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s3) var(--s2); }
.bg { display: grid; gap: 6px; text-align: left; font-size: var(--text-xs); color: var(--muted-foreground); }
.bg i { display: grid; place-items: center; aspect-ratio: 1.6; border-radius: var(--radius-md); box-shadow: inset 0 0 0 1px var(--border); background-size: cover !important; background-position: center !important; color: var(--subtle); transition: transform var(--dur-2) var(--ease); }
.bg:hover i { transform: translateY(-2px); }
.bg.on i { box-shadow: 0 0 0 2px var(--popover), 0 0 0 4px var(--foreground); }
.bg.on { color: var(--foreground); }
.bg span { display: flex; align-items: center; gap: 5px; }
.fonts { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: var(--s2); }
.fo { position: relative; display: grid; gap: 2px; padding: var(--s3) var(--s3) var(--s2); border-radius: var(--radius-md); text-align: left; box-shadow: inset 0 0 0 1px var(--border); transition: box-shadow var(--dur-1), background var(--dur-1); }
.fo:hover { background: var(--muted); }
.fo.on { box-shadow: inset 0 0 0 1.5px var(--foreground); }
.fo b { font-size: 22px; font-weight: 500; line-height: 1.1; }
.fo.big b { font-size: 24px; letter-spacing: -.02em; }
.fo span { font-size: var(--text-xs); color: var(--muted-foreground); }
.fo .lk { position: absolute; top: var(--s2); right: var(--s2); font-style: normal; }
.rng-w { display: flex; align-items: center; gap: var(--s3); }
.rng { flex: 1; -webkit-appearance: none; appearance: none; height: 4px; border-radius: 4px; background: var(--input); }
.rng::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--card); box-shadow: 0 1px 3px rgb(0 0 0 / .25), 0 0 0 1px var(--input); cursor: pointer; }
.rng:disabled { opacity: .45; }
.rng-w .meta { min-width: 44px; text-align: right; margin: 0; }
.meter-r { display: grid; grid-template-columns: 110px 1fr 96px; align-items: center; gap: var(--s3); height: var(--h-md); font-size: var(--text-md); }
.meter-r .meta { text-align: right; }
.bar { height: 6px; border-radius: 6px; background: var(--muted); box-shadow: inset 0 0 0 1px var(--border); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 6px; background: var(--foreground); transition: width .4s var(--ease); }
.upsell { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-top: var(--s3); padding: var(--s3) var(--s4); border-radius: var(--radius-md); background: color-mix(in srgb, var(--primary) 8%, var(--card)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 22%, transparent); font-size: var(--text-sm); color: var(--muted-foreground); }
.upsell b { color: var(--foreground); }
.key-r { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: var(--h-md); font-size: var(--text-md); }
.key-r > span:last-child { display: flex; gap: var(--s1); }

/* Befehlspalette */
.palette { position: fixed; left: 50%; top: 13vh; width: min(620px, calc(100vw - 32px)); border-radius: calc(var(--radius-lg) + 2px); background: var(--popover); box-shadow: var(--shadow-lg); transform: translateX(-50%); overflow: hidden; animation: dpop .18s var(--ease) both; }
.palette-in { display: flex; align-items: center; gap: var(--s3); height: 54px; padding: 0 var(--s4); border-bottom: 1px solid var(--border); color: var(--subtle); }
.palette-in input { flex: 1; border: 0; background: transparent; font-size: var(--text-lg); color: var(--foreground); }
.palette-in input:focus-visible { outline: none; }
.palette-l { max-height: 380px; overflow: auto; padding: var(--s1); }
.palette .mi { height: var(--h-xl); }
.palette .mi .row-d { flex: 0 1 auto; margin-left: var(--s1); }
.palette-f { display: flex; gap: var(--s4); padding: var(--s2) var(--s4); border-top: 1px solid var(--border); color: var(--muted-foreground); font-size: var(--text-xs); }

/* Toasts: passend zum Theme invertiert */
#toasts { position: fixed; z-index: 60; left: 50%; bottom: var(--s6); transform: translateX(-50%); display: grid; gap: var(--s2); justify-items: center; }
.toast { display: flex; align-items: center; gap: var(--s3); height: var(--h-xl); padding: 0 6px 0 var(--s4); border-radius: var(--radius-md); background: var(--foreground); color: var(--background); font-size: var(--text-sm); box-shadow: 0 14px 36px -10px rgb(0 0 0 / .45); animation: up .3s var(--ease) both; }
.toast.out { animation: down .2s ease-in both; }
.toast .solo { padding-right: var(--s2); }
.toast button { height: var(--h-sm); padding: 0 var(--s3); border-radius: var(--radius-sm); font-weight: 600; color: var(--background); background: color-mix(in srgb, var(--background) 16%, transparent); }
.toast button:hover { background: color-mix(in srgb, var(--background) 26%, transparent); }

/* ---------- Bewegung ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(-4px); } }
@keyframes dpop { from { opacity: 0; transform: translateX(-50%) scale(.97) translateY(-6px); } to { transform: translateX(-50%); } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes down { to { opacity: 0; transform: translateY(8px); } }
body.ready .card, body.ready .edit { animation: none; }
body.no-motion *, body.no-motion *::before, body.no-motion *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Kleine Bildschirme ---------- */
/* Mittlere Breite: Suche schmaler, damit die Workspace-Tabs nicht abgeschnitten werden */
@media (min-width: 761px) and (max-width: 1100px) { .top { grid-template-columns: minmax(0, 1fr) minmax(200px, 340px) auto; } }
@media (max-width: 760px) {
  .top { grid-template-columns: 1fr auto; height: auto; padding: var(--s3) var(--s4); row-gap: var(--s2); }
  .search { grid-column: 1 / -1; grid-row: 2; }
  .hero { padding: var(--s6) var(--s4); }
  .board { padding: 0 var(--s4) var(--s10); grid-template-columns: 1fr; }
  .card.wide { grid-column: auto; }
  .drawer { left: var(--s2); right: var(--s2); width: auto; top: auto; height: 70vh; }
  .bgs { grid-template-columns: repeat(3, 1fr); } .meter-r { grid-template-columns: 90px 1fr 72px; }
  .icons { grid-template-columns: repeat(6, 1fr); }
}

/* Helfer: Browserleiste passend färben */
.bh { display: flex; gap: var(--s4); align-items: flex-start; }
.bh-prev { position: relative; flex-shrink: 0; width: 112px; height: 72px; border-radius: var(--radius-md); overflow: hidden; background: var(--bh-bg); box-shadow: inset 0 0 0 1px var(--border); }
.bh-prev i { position: absolute; inset: 0 0 auto; height: 18px; background: color-mix(in srgb, var(--bh-bg) 88%, #000); }
.bh-prev b { position: absolute; top: 6px; left: 10px; width: 36px; height: 12px; border-radius: 4px 4px 0 0; background: var(--bh-bg); }
.bh-prev span { position: absolute; top: 24px; left: 10px; right: 10px; height: 10px; border-radius: 5px; background: var(--bh-card); box-shadow: 0 0 0 1px rgb(0 0 0 / .06); }
.bh-t { min-width: 0; font-size: var(--text-md); }
.bh-t p { margin: 0; }
.bh-t .tip { margin-top: var(--s2); }
.bh-a { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s3); }

.scrim.noanim { animation: none; }

/* Pro holen, Konto ohne Passwort */
.plans-x { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); margin: var(--s4) 0; }
.plan-x { display: grid; gap: 2px; padding: var(--s4); border-radius: var(--radius-md); text-align: left; box-shadow: inset 0 0 0 1px var(--border); transition: box-shadow var(--dur-1), background var(--dur-1); }
.plan-x:hover { background: var(--muted); }
.plan-x.on { box-shadow: inset 0 0 0 2px var(--foreground); }
.plan-x b { font-size: var(--text-md); } .plan-x span { font: 400 26px/1.1 var(--font-display); letter-spacing: -.02em; } .plan-x small { color: var(--muted-foreground); font-size: var(--text-xs); }
/* Upgrade-Fenster: Band oben, Vergleich Free/Pro, Abrechnung, ein klarer Button */
.dialog:has(.up-band) { width: min(520px, calc(100vw - 32px)); padding: 0; overflow: hidden auto; }
.dialog:has(.up-band) > :not(.up-band) { margin-inline: var(--s5); }
.up-band { position: relative; display: flex; align-items: baseline; gap: var(--s2); padding: var(--s6) var(--s5) var(--s5); background: radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--primary) 55%, #fff) 0%, transparent 60%), var(--primary); color: var(--on-primary); }
.up-band > span:first-child { font: 500 var(--text-xs) var(--font-mono); letter-spacing: .12em; text-transform: uppercase; opacity: .85; }
.up-band b { font: 700 40px/1 var(--font-ui); letter-spacing: -.04em; }
.up-band .pro-tag { margin-left: auto; align-self: center; background: rgb(0 0 0 / .22); color: #fff; }
.up-table { margin-top: var(--s4); font-size: var(--text-sm); }
.up-tr { display: grid; grid-template-columns: 1.2fr .8fr 1.2fr; align-items: center; border-top: 1px solid var(--border); }
.up-tr > span { padding: 7px var(--s2); } .up-tr > span:first-child { padding-left: 0; color: var(--muted-foreground); } .up-tr > span:nth-child(2) { color: var(--muted-foreground); }
.up-tr > span:nth-child(3) { align-self: stretch; display: flex; align-items: center; background: var(--muted); font-weight: 500; }
.up-th { border-top: 0; font: 500 10px var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
.up-th > span:nth-child(3) { border-radius: 8px 8px 0 0; color: var(--primary); } .up-tr:last-child > span:nth-child(3) { border-radius: 0 0 8px 8px; }
.up-bill { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); margin-top: var(--s4); }
.up-b { display: grid; gap: 6px; padding: var(--s3); border-radius: var(--radius-md); text-align: left; box-shadow: inset 0 0 0 1px var(--border); transition: box-shadow var(--dur-1), background var(--dur-1); }
.up-b:hover { background: var(--muted); } .up-b.on { box-shadow: inset 0 0 0 2px var(--foreground); }
.up-bl { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); font-size: var(--text-xs); color: var(--muted-foreground); }
.up-bl em { padding: 2px 6px; border-radius: 5px; background: var(--muted); font-style: normal; font-size: 10.5px; white-space: nowrap; }
.up-bl em.hot { background: color-mix(in srgb, var(--primary) 15%, transparent); color: var(--primary); font-weight: 600; }
.up-bp { display: flex; align-items: baseline; gap: 5px; font-size: var(--text-xs); color: var(--muted-foreground); }
.up-bp b { font-size: 19px; font-weight: 600; letter-spacing: -.02em; color: var(--foreground); }
.up-acts { margin-bottom: var(--s5); }
.up-cta { width: 100%; height: var(--h-2xl, 44px); margin-top: var(--s4); justify-content: center; font-size: var(--text-md); }
.up-acts .tip { margin: var(--s3) 0 0; text-align: center; }
.linkish { padding: 0; border: 0; background: none; color: var(--foreground); font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.dialog:has(.up-band) .wait { margin-block: var(--s5); }
.dialog:has(.up-band) .acts { margin-bottom: var(--s5); }
.wait { display: flex; gap: var(--s4); align-items: center; margin: var(--s5) 0 var(--s2); }
.wait p { margin: 0; color: var(--muted-foreground); }
.spin { flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--muted); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.card.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 40% { outline: 2px solid var(--primary); outline-offset: 3px; } 100% { outline: 2px solid transparent; outline-offset: 3px; } }
.acc { padding: var(--s2) 0 var(--s4); }
.acc-h { display: flex; align-items: center; gap: var(--s3); }
.acc-h b { display: block; font-size: var(--text-md); } .acc-h small { color: var(--muted-foreground); font-size: var(--text-xs); }
.acc-badge { display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--radius-md); background: var(--muted); color: var(--muted-foreground); font: 600 10px var(--font-mono); letter-spacing: .06em; }
.acc-badge.pro { background: var(--primary); color: var(--on-primary); }
.row-btns { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s3); }
.field.code { font: 500 22px var(--font-mono); letter-spacing: .4em; text-align: center; }
.avatar.pro { box-shadow: 0 0 0 2px var(--background), 0 0 0 3.5px var(--primary); }

/* Symbole: Emojis */
.i.emo, .emo { display: inline-grid; place-items: center; font-size: 14px; line-height: 1; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.card-ic .i.emo { font-size: 15px; } .ws .ws-i .i.emo { font-size: 13px; }
.card.tinted .card-ic:has(.emo) { background: color-mix(in srgb, var(--tint) 18%, transparent); }

/* Farbwähler: Vorgaben + jede Farbe */
.cpick { display: grid; gap: var(--s2); }
.dt.custom { cursor: pointer; overflow: hidden; background: conic-gradient(#e5484d, #ffb224, #30a46c, #0090ff, #8e4ec6, #e5484d); color: #fff; }
.dt.custom .i { width: 12px; height: 12px; filter: drop-shadow(0 1px 1px rgb(0 0 0 / .4)); }
.dt.custom.on { background: var(--c); }
.c-native { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; border: 0; padding: 0; }
.hex-row { display: flex; align-items: center; gap: var(--s2); }
.hex-sw { flex-shrink: 0; width: var(--h-md); height: var(--h-md); border-radius: var(--radius-md); box-shadow: inset 0 0 0 1px var(--input); background-image: linear-gradient(45deg, var(--muted) 25%, transparent 25% 75%, var(--muted) 75%), linear-gradient(45deg, var(--muted) 25%, transparent 25% 75%, var(--muted) 75%); background-size: 8px 8px; background-position: 0 0, 4px 4px; }
.field.hex { font-family: var(--font-mono); text-transform: uppercase; }
.sub-l { display: flex; align-items: center; gap: 6px; margin: var(--s4) 0 var(--s2); font-size: var(--text-sm); color: var(--muted-foreground); }
.locked-area { opacity: .55; }

/* Symbol-Auswahl */
.ipick { display: grid; gap: var(--s2); }
.ipick .icons { max-height: 200px; overflow: auto; padding-right: 2px; scrollbar-width: thin; }
.ipick .ic-b .emo { font-size: 17px; }
.ipick .empty { grid-column: 1 / -1; }

/* Eigene Farbwelt: alle Tokens aus Hintergrund und Schriftfarbe abgeleitet */
body.custom-theme { --card: color-mix(in srgb, var(--background) 55%, #fff); --popover: var(--card); --muted: color-mix(in srgb, var(--background) 88%, var(--foreground)); --border: color-mix(in srgb, var(--background) 84%, var(--foreground)); --input: color-mix(in srgb, var(--background) 72%, var(--foreground)); --muted-foreground: color-mix(in srgb, var(--foreground) 64%, var(--background)); --subtle: color-mix(in srgb, var(--foreground) 46%, var(--background)); }
body.custom-theme.custom-dark { --card: color-mix(in srgb, var(--background) 92%, #fff); --popover: color-mix(in srgb, var(--background) 88%, #fff); --shadow-lg: 0 24px 60px -12px rgb(0 0 0 / .7), 0 0 0 1px var(--border); }

/* Beim Laden keine Übergänge: Farbwelt steht sofort (boot.js), Wechsel danach bleiben animiert */
body.preload, body.preload *, body.preload *::before, body.preload *::after { transition: none !important; }

/* ---------- ASCII-Hintergrund ---------- */
#ascii { position: fixed; inset: 0; z-index: -1; width: 100%; height: 100%; pointer-events: none; opacity: 0; transition: opacity .6s var(--ease);
  /* hinter der Uhr ruhiger, damit sie lesbar bleibt */
  -webkit-mask-image: radial-gradient(ellipse 34% 22% at 50% 15%, rgb(0 0 0 / .2), #000 100%); mask-image: radial-gradient(ellipse 34% 22% at 50% 15%, rgb(0 0 0 / .2), #000 100%); }
body.no-clock #ascii { -webkit-mask-image: none; mask-image: none; }
.ascii-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s3) var(--s2); }
.asc { display: grid; gap: 6px; text-align: left; font-size: var(--text-xs); color: var(--muted-foreground); }
.asc-cv, .asc-off { display: block; width: 100%; aspect-ratio: 1.6; border-radius: var(--radius-md); background: var(--background); box-shadow: inset 0 0 0 1px var(--border); transition: transform var(--dur-2) var(--ease); }
.asc-off { display: grid; place-items: center; font: 500 var(--text-xs) var(--font-mono); font-style: normal; color: var(--subtle); }
.asc:hover .asc-cv, .asc:hover .asc-off { transform: translateY(-2px); }
.asc.on .asc-cv, .asc.on .asc-off { box-shadow: 0 0 0 2px var(--popover), 0 0 0 4px var(--foreground); }
.asc.on { color: var(--foreground); }
.asc span { display: flex; align-items: center; gap: 5px; }
.asc-opts { display: grid; gap: var(--s2); margin-top: var(--s3); }
.asc-opts .sub-l { margin: var(--s2) 0 0; }

/* ---------- 1 Masonry ---------- */
body.layout-masonry .board { grid-auto-rows: 4px; row-gap: 0; column-gap: var(--s4); }

/* ---------- 3 Favicons in gleich großen Kacheln ---------- */
.fav.tiled { border-radius: 6px; }
.fav.tiled.has-img { background: color-mix(in srgb, var(--foreground) 6%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--foreground) 6%, transparent); }
.fav.tiled img { inset: 4px; width: calc(100% - 8px); height: calc(100% - 8px); }
.row { gap: var(--s3); padding-left: 6px; }

/* ---------- 4 Weniger Rauschen: leichtere Links, Domain nur bei Platz ---------- */
.row-t { flex: 0 1 auto; font-weight: 450; }
body[data-theme="moss"] .row-t, body[data-theme="ink"] .row-t, body[data-theme="night"] .row-t, body.custom-dark .row-t { font-weight: 400; }
.row-d { flex: 1 1 0; }
.card-t { font-weight: 600; letter-spacing: -.005em; }

/* ---------- 5 Karten-Logo (Favicon der häufigsten Seite) ---------- */
.card-ic.auto { background: color-mix(in srgb, var(--foreground) 5%, transparent); }
.card-ic.auto .fav { border-radius: 4px; }
.card.tinted .card-ic.auto { background: color-mix(in srgb, var(--tint) 16%, transparent); }

/* ---------- 6 Uhr schrumpft beim Scrollen in die Kopfzeile ---------- */
.hero { transform-origin: 50% 0; will-change: opacity, transform; }
.mini-clock { font: 400 22px/1 var(--font-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-right: var(--s2); opacity: 0; transform: translateY(6px); transition: opacity var(--dur-2), transform var(--dur-2) var(--ease); pointer-events: none; }
.top.mini .mini-clock { opacity: 1; transform: none; }
body.no-clock .mini-clock { display: none; }

/* ---------- 7 Dezente Neu-Karte ---------- */
.new-card { min-height: 72px; opacity: .55; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--border) 80%, transparent); background-image: repeating-linear-gradient(135deg, transparent 0 7px, color-mix(in srgb, var(--foreground) 2.5%, transparent) 7px 8px); transition: opacity var(--dur-2), box-shadow var(--dur-2), transform var(--dur-2) var(--ease); }
.new-card:hover, .new-card:focus-within, body.is-dragging .new-card { opacity: 1; box-shadow: inset 0 0 0 1px var(--input), var(--shadow-md); transform: translateY(-1px); }
@media (max-width: 760px) { .ascii-grid { grid-template-columns: repeat(3, 1fr); } }

/* Hintergrundfarbe liegt auf <html> (boot.js/applyLook), damit Bild, Verlauf und ASCII dahinter sichtbar bleiben */
html { background: #f6f4ef; transition: background-color .5s var(--ease); }
html:has(body.preload) { transition: none; }
body { background: transparent; }

/* ---------- Websuche: Kürzel ---------- */
.bangs { display: grid; gap: 6px; }
.bang { display: grid; grid-template-columns: 64px 120px 1fr var(--h-sm); gap: 6px; align-items: center; }
.bang .field { height: var(--h-md); font-size: var(--text-sm); } .bang .k { font-family: var(--font-mono); } .bang .u { font-family: var(--font-mono); font-size: var(--text-xs); }

/* ---------- Zeitplan für Workspaces ---------- */
.ws-auto { display: inline-grid; color: var(--muted-foreground); } .ws-auto .i { width: 12px; height: 12px; }
.sched { display: grid; gap: var(--s2); margin-top: var(--s2); }
.days { display: flex; gap: 4px; }
.day { flex: 1; height: var(--h-sm); border-radius: var(--radius-sm); font-size: var(--text-xs); font-weight: 600; color: var(--muted-foreground); box-shadow: inset 0 0 0 1px var(--border); transition: background var(--dur-1), color var(--dur-1); }
.day.on { background: var(--foreground); color: var(--background); box-shadow: none; }
.times { display: flex; align-items: center; gap: var(--s2); font-size: var(--text-sm); color: var(--muted-foreground); }
.field.time { width: auto; flex: 1; font-family: var(--font-mono); }

/* ---------- Tab-Aufräumer, Verlauf, Teaser ---------- */
.cleaner { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: var(--s1) var(--s1) var(--s2); }
.cleaner .btn { height: var(--h-md); font-size: var(--text-xs); padding: 0 var(--s2); }
.cleaner .btn .i { width: 14px; height: 14px; }
.teaser { display: grid; justify-items: start; gap: var(--s2); margin: var(--s2); padding: var(--s4); border-radius: var(--radius-md); background: color-mix(in srgb, var(--primary) 7%, var(--card)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 20%, transparent); }
.teaser .i { color: var(--primary); width: 20px; height: 20px; } .teaser p { margin: 0; color: var(--muted-foreground); font-size: var(--text-sm); }
.dead { display: grid; gap: 2px; max-height: 50vh; overflow: auto; margin-top: var(--s3); }
.dialog .bar { margin-top: var(--s2); }

/* ---------- Markdown in Notizen ---------- */
.md { min-height: 64px; cursor: text; font-size: var(--text-lg); line-height: 1.55; overflow-wrap: anywhere; border-radius: var(--radius-sm); }
.md p { margin: 0; } .md h4, .md h5, .md h6 { margin: 2px 0 4px; font-weight: 600; } .md h4 { font-size: 17px; } .md h5 { font-size: 15px; } .md h6 { font-size: 13.5px; color: var(--muted-foreground); }
.md ul { margin: 2px 0; padding-left: 18px; } .md li { margin: 2px 0; }
.md li.task { list-style: none; margin-left: -18px; display: flex; gap: var(--s2); align-items: baseline; }
.md li.task.done { color: var(--muted-foreground); text-decoration: line-through; }
.md input[type=checkbox], .todo input[type=checkbox], .row.later input[type=checkbox] { accent-color: var(--primary); width: 15px; height: 15px; margin: 0; flex-shrink: 0; cursor: pointer; }
.md code { font: 500 .88em var(--font-mono); padding: 1px 5px; border-radius: 4px; background: color-mix(in srgb, var(--foreground) 8%, transparent); }
.md a { color: var(--primary); text-decoration: none; } .md a:hover { text-decoration: underline; }

/* ---------- Widgets ---------- */
.card-b[class*="w-"] { padding: 0 var(--s3) var(--s3); }
.w-later, .w-top, .w-recent { padding: 0 var(--s2) var(--s2) !important; }
.todo { display: flex; align-items: center; gap: var(--s3); min-height: var(--h-md); padding: 0 2px; border-radius: var(--radius-sm); cursor: pointer; }
.todo .ib { opacity: 0; margin-left: auto; } .todo:hover .ib, .todo:focus-within .ib { opacity: 1; }
.todo-t { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.todo.done .todo-t { color: var(--muted-foreground); text-decoration: line-through; }
.todo .field { height: var(--h-sm); }
.todo-in { margin-top: var(--s2); height: var(--h-md); }
.row.later { gap: var(--s2); } .row.later .fav { margin-left: 2px; }
.row.win { width: 100%; text-align: left; } .row.win .i { width: 22px; color: var(--muted-foreground); }
.timer-l { font-size: var(--text-sm); color: var(--muted-foreground); }
.timer-d { font: 400 64px/1 var(--font-display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin: var(--s2) 0 var(--s3); }
.w-timer .bar i { background: var(--primary); transition: width 1s linear; }
.w-timer .row-btns { margin: var(--s3) 0; }
.wx-now { display: flex; align-items: center; gap: var(--s4); }
.wx-i { color: var(--primary); } .wx-i .i { width: 44px; height: 44px; } .wx-i svg { stroke-width: 1.4; }
.wx-t { font: 400 52px/1 var(--font-display); letter-spacing: -.03em; }
.wx-l { font-weight: 500; } .wx-now small { color: var(--muted-foreground); font-size: var(--text-xs); }
.wx-days { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid var(--border); }
.wx-day { display: grid; justify-items: center; gap: 4px; font-size: var(--text-xs); color: var(--muted-foreground); }
.wx-day b { color: var(--foreground); font-size: var(--text-md); font-weight: 600; } .wx-day .i { width: 18px; height: 18px; }
.ev { display: flex; gap: var(--s3); padding: var(--s2) 0; border-top: 1px solid var(--border); font-size: var(--text-md); }
.ev:first-child { border-top: 0; }
.ev-d { flex-shrink: 0; width: 84px; font-weight: 600; font-size: var(--text-sm); } .ev-d small { display: block; color: var(--muted-foreground); font-weight: 400; }
.ev-t { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 760px) { .bang { grid-template-columns: 54px 1fr var(--h-sm); } .bang .u { grid-column: 1 / -2; } .cleaner { grid-template-columns: 1fr; } }
