/* ============ Paletten (alle bläulich, augenschonend) ============ */
:root, [data-palette="ozean"] {
  --bg: #edf3f9; --surface: #ffffff; --surface-2: #e4edf6; --line: #d3e0ec; --text: #1d3349; --muted: #637a90;
  --primary: #3a6b9f; --primary-ink: #ffffff; --primary-soft: #d6e5f3; --event: #4f86bd; --event-ink: #ffffff; --danger: #b4505a; --ok: #3d8a78;
  --shadow: 0 1px 2px rgba(29, 51, 73, .06), 0 4px 16px rgba(29, 51, 73, .06); color-scheme: light;
}
[data-palette="nebel"]     { --bg:#f0f3f7; --surface:#fbfcfd; --surface-2:#e6ebf1; --line:#d8dfe8; --text:#2a3646; --muted:#6c7889; --primary:#5b7593; --primary-soft:#dde5ee; --event:#7891ae; }
[data-palette="gletscher"] { --bg:#eaf5f8; --surface:#ffffff; --surface-2:#dcedf2; --line:#c9e1e8; --text:#173a44; --muted:#5a7d87; --primary:#2f7d93; --primary-soft:#cfe8ef; --event:#3f97ae; }
[data-palette="fjord"]     { --bg:#e9eff6; --surface:#f9fbfd; --surface-2:#dbe5f0; --line:#c7d5e5; --text:#1a2c44; --muted:#5b6f88; --primary:#2c5585; --primary-soft:#d2deec; --event:#3d6a9e; }
[data-palette="petrol"]    { --bg:#e8f2f2; --surface:#fbfefe; --surface-2:#d9e9ea; --line:#c4dadb; --text:#16373a; --muted:#587a7c; --primary:#2a6f73; --primary-soft:#cde5e6; --event:#38878b; }
[data-palette="lavendel"]  { --bg:#eff0f9; --surface:#ffffff; --surface-2:#e3e5f4; --line:#d3d6ec; --text:#252a4a; --muted:#6a6f92; --primary:#5560a8; --primary-soft:#dcdff3; --event:#6f79bd; }
[data-palette="nordsee"]   { --bg:#e7eef3; --surface:#f8fafc; --surface-2:#d8e3eb; --line:#c3d2de; --text:#1f3240; --muted:#5f7484; --primary:#406a85; --primary-soft:#cfdde8; --event:#5682a0; }
[data-palette="schiefer"]  { --bg:#ebeef2; --surface:#fafbfc; --surface-2:#dfe4ea; --line:#cdd4dd; --text:#232d38; --muted:#646f7c; --primary:#4a5d74; --primary-soft:#d8dee6; --event:#617691; }
[data-palette="mitternacht"] {
  --bg:#141d2b; --surface:#1b2638; --surface-2:#223047; --line:#2d3d57; --text:#dbe5f2; --muted:#8fa2bb;
  --primary:#7fa8d9; --primary-ink:#10192a; --primary-soft:#26385a; --event:#4a76ab; --event-ink:#f1f6fc; --danger:#e08a92; --ok:#7cc2b0;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25); color-scheme: dark;
}
[data-palette="tiefsee"] {
  --bg:#0f1e24; --surface:#152a32; --surface-2:#1b3540; --line:#25444f; --text:#d6ebef; --muted:#87a9b2;
  --primary:#6fbfcf; --primary-ink:#0b1a1f; --primary-soft:#1f4652; --event:#3b8394; --event-ink:#effafc; --danger:#e3949a; --ok:#86cdb8;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25); color-scheme: dark;
}

/* ============ Grundlagen ============ */
* { box-sizing: border-box; }
html { font-size: calc(15px * var(--scale, 1)); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: 'Lexend', system-ui, -apple-system, 'Segoe UI', sans-serif; font-weight: 400; line-height: 1.5;
  background: var(--bg); color: var(--text);
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
}
body, .surface, .card, .sidebar, .topbar, input, textarea, select, button, .chip, .modal {
  transition: background-color .45s ease, color .45s ease, border-color .45s ease;
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { font-weight: 500; margin: 0; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: .5rem; }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }

/* Buttons & Eingaben */
.btn {
  display: inline-flex; align-items: center; gap: .45rem; border: 1px solid var(--line); background: var(--surface);
  padding: .5rem .95rem; border-radius: 999px; cursor: pointer; font-weight: 400; white-space: nowrap; text-decoration: none; color: var(--text);
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.soft { background: var(--primary-soft); border-color: transparent; color: var(--text); }
.btn.danger { color: var(--danger); }
.btn.big { padding: .8rem 1.3rem; border-radius: 18px; box-shadow: var(--shadow); border-color: transparent; }
.btn.sm { padding: .3rem .7rem; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { border: 0; background: transparent; width: 2.4rem; height: 2.4rem; border-radius: 50%; cursor: pointer; display: inline-grid; place-items: center; font-size: 1.1rem; color: var(--muted); flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.wa { color: #25a35a; }
input[type=text], input[type=password], input[type=email], input[type=url], input[type=number], input[type=date], input[type=time], input[type=search], select, textarea {
  width: 100%; padding: .6rem .8rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea { resize: vertical; min-height: 6rem; line-height: 1.55; }
label.field { display: grid; gap: .3rem; font-size: .88rem; color: var(--muted); }
label.field > span { padding-left: .2rem; }
.check { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; }
.check input { width: 1.1rem; height: 1.1rem; accent-color: var(--primary); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.stack { display: grid; gap: .9rem; }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .6rem; border-radius: 999px; background: var(--surface-2); font-size: .8rem; color: var(--muted); }
.chip.due-over { color: var(--danger); border: 1px solid currentColor; background: transparent; }
.chip.due { border: 1px solid var(--line); background: transparent; }
.card { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); }
.empty { text-align: center; color: var(--muted); padding: 3rem 1rem; }
.empty .big-emoji { font-size: 2.6rem; display: block; margin-bottom: .5rem; opacity: .8; }

/* ============ Login ============ */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background: radial-gradient(1200px 600px at 10% -10%, var(--primary-soft), transparent 60%), radial-gradient(900px 500px at 110% 110%, var(--surface-2), transparent 60%), var(--bg);
}
.login .card { width: min(380px, 100%); padding: 2.2rem 2rem; }
.login h1 { font-size: 1.6rem; font-weight: 400; margin-bottom: .2rem; }
.wave { width: 56px; height: 56px; border-radius: 16px; background: var(--primary); display: grid; place-items: center; margin-bottom: 1.2rem; }

/* ============ Rahmen ============ */
.shell { display: grid; grid-template-columns: var(--rail, 264px) 1fr; grid-template-rows: 64px 1fr; height: 100vh; height: 100dvh; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: .6rem; padding: 0 .9rem 0 .6rem; background: var(--bg); min-width: 0; }
.brand { display: flex; align-items: center; gap: .6rem; font-size: 1.25rem; min-width: calc(var(--rail, 264px) - 3.6rem); text-decoration: none; color: var(--text); }
.brand .logo { width: 36px; height: 36px; border-radius: 10px; background: var(--primary); display: grid; place-items: center; }
.top-tools { display: flex; align-items: center; gap: .4rem; min-width: 0; flex: 1; }
.top-tools h2 { font-size: 1.35rem; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kw { font-size: .72rem; background: var(--surface-2); color: var(--muted); padding: .1rem .4rem; border-radius: 6px; }
.searchbox { position: relative; width: min(460px, 36vw); }
.searchbox input { border-radius: 999px; padding-left: 2.4rem; background: var(--surface-2); border-color: transparent; }
.searchbox .s-ico { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; max-height: 70vh; overflow: auto; padding: .5rem; z-index: 40; }
.search-results h4 { margin: .6rem .6rem .2rem; font-weight: 500; font-size: .8rem; color: var(--muted); }
.sr-item { display: flex; gap: .6rem; padding: .45rem .6rem; border-radius: 10px; cursor: pointer; align-items: baseline; }
.sr-item:hover, .sr-item.active { background: var(--surface-2); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-soft); display: grid; place-items: center; font-weight: 500; cursor: pointer; border: 0; color: var(--text); }

.sidebar { padding: .4rem .6rem 1.2rem; overflow-y: auto; display: flex; flex-direction: column; gap: .3rem; }
.nav a, .nav button.navlink {
  display: flex; align-items: center; gap: .9rem; padding: .62rem 1rem; border-radius: 999px; text-decoration: none; color: var(--text);
  border: 0; background: transparent; width: 100%; text-align: left; cursor: pointer; font-size: .95rem;
}
.nav a:hover, .nav button.navlink:hover { background: var(--surface-2); }
.nav a.active { background: var(--primary-soft); font-weight: 500; }
.nav .ico { width: 1.4rem; text-align: center; }
.side-h { font-size: .85rem; color: var(--muted); padding: .8rem 1rem .2rem; display: flex; justify-content: space-between; align-items: center; }
.side-slot { margin-bottom: .4rem; }
.main { overflow: auto; background: var(--surface); border-top-left-radius: 22px; position: relative; }
.page { padding: 1.4rem 1.6rem 3rem; max-width: 1400px; }
.page-head { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.page-head h1 { font-size: 1.5rem; font-weight: 400; }
.banner { background: var(--primary-soft); padding: .7rem 1rem; border-radius: 14px; margin-bottom: 1rem; display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }
.scrim { display: none; }

@media (min-width: 861px) { .shell.collapsed { grid-template-columns: 0 1fr; } .shell.collapsed .sidebar { display: none; } .shell.collapsed .main { border-top-left-radius: 0; } }

/* ============ Mini-Kalender ============ */
.mini { padding: .4rem .6rem; font-size: .78rem; }
.mini .mh { display: flex; align-items: center; justify-content: space-between; padding: 0 .2rem .3rem .4rem; font-size: .9rem; }
.mini table { width: 100%; border-collapse: collapse; text-align: center; }
.mini th { font-weight: 400; color: var(--muted); padding: .2rem 0; }
.mini td { padding: 1px; }
.mini td.wk { color: var(--muted); font-size: .7rem; background: var(--surface-2); }
.mini button { width: 1.9rem; height: 1.9rem; border-radius: 50%; border: 0; background: transparent; cursor: pointer; font-size: .78rem; }
.mini button:hover { background: var(--surface-2); }
.mini button.other { color: var(--muted); opacity: .6; }
.mini button.today { background: var(--primary); color: var(--primary-ink); }
.mini button.sel:not(.today) { background: var(--primary-soft); }

/* ============ Kalender ============ */
.cal { display: flex; flex-direction: column; height: 100%; }
.month { display: grid; grid-template-columns: 2rem repeat(7, 1fr); grid-auto-rows: minmax(110px, 1fr); flex: 1; min-height: 640px; }
.month .dow { text-align: center; font-size: .72rem; color: var(--muted); padding: .55rem 0 .2rem; border-left: 1px solid var(--line); }
.month .dow.first { border-left: 0; }
.month .wkcol { font-size: .72rem; color: var(--muted); padding: .35rem 0; text-align: center; background: var(--surface-2); border-top: 1px solid var(--line); }
.month .cell { border-left: 1px solid var(--line); border-top: 1px solid var(--line); padding: .25rem .2rem; min-width: 0; cursor: pointer; overflow: hidden; }
.month .cell:hover { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }
.month .num { text-align: center; font-size: .78rem; margin-bottom: .2rem; }
.month .num span { display: inline-grid; place-items: center; min-width: 1.6rem; height: 1.6rem; border-radius: 999px; padding: 0 .3rem; }
.month .cell.other .num { color: var(--muted); }
.month .cell.today .num span { background: var(--primary); color: var(--primary-ink); }
.ev {
  display: block; width: 100%; border: 0; text-align: left; cursor: pointer; font-size: .76rem; font-weight: 500; padding: .12rem .45rem; margin-bottom: 2px;
  border-radius: 6px; background: var(--event); color: var(--event-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ev.timed { background: transparent; color: var(--text); font-weight: 400; }
.ev.timed::before { content: ''; display: inline-block; width: .5rem; height: .5rem; border-radius: 50%; background: var(--event); margin-right: .35rem; }
.ev.src-google { --event: color-mix(in srgb, var(--event) 85%, #7b5fb5); }
.ev.src-outlook { --event: color-mix(in srgb, var(--event) 80%, #1f6fb2); }
.more { font-size: .74rem; color: var(--muted); padding-left: .4rem; border: 0; background: transparent; cursor: pointer; }
.week { display: grid; grid-template-columns: 3.6rem repeat(var(--days), 1fr); flex: 1; min-height: 0; }
.week-head { display: contents; }
.wh { text-align: center; padding: .5rem 0 .3rem; border-left: 1px solid transparent; }
.wh .d { font-size: .72rem; color: var(--muted); }
.wh .n { font-size: 1.6rem; font-weight: 300; width: 2.8rem; height: 2.8rem; display: inline-grid; place-items: center; border-radius: 50%; cursor: pointer; }
.wh.today .n { background: var(--primary); color: var(--primary-ink); }
.allday { border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 2px; min-height: 1.6rem; }
.tz { font-size: .68rem; color: var(--muted); text-align: right; padding-right: .4rem; border-bottom: 1px solid var(--line); align-self: end; }
.grid-scroll { grid-column: 1 / -1; overflow-y: auto; display: grid; grid-template-columns: 3.6rem repeat(var(--days), 1fr); position: relative; }
.hours { position: relative; }
.hours div { height: 48px; font-size: .68rem; color: var(--muted); text-align: right; padding-right: .5rem; transform: translateY(-.5em); }
.daycol { position: relative; border-left: 1px solid var(--line); background-image: repeating-linear-gradient(to bottom, var(--line) 0, var(--line) 1px, transparent 1px, transparent 48px); height: calc(48px * 24); cursor: pointer; }
.tev { position: absolute; left: 2px; right: 4px; border-radius: 8px; background: var(--event); color: var(--event-ink); font-size: .75rem; padding: .2rem .4rem; overflow: hidden; cursor: pointer; border: 1px solid var(--surface); line-height: 1.3; }
.tev small { display: block; opacity: .85; }
.nowline { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 3; pointer-events: none; }
.nowline::before { content: ''; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }
.cal-tools { display: flex; align-items: center; gap: .4rem; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: .45rem .9rem; cursor: pointer; }
.seg button.on { background: var(--primary-soft); font-weight: 500; }
.ev-detail .meta { display: grid; grid-template-columns: 1.6rem 1fr; gap: .5rem .4rem; align-items: start; margin: .8rem 0 1rem; }

/* ============ Aufgaben ============ */
.task-board { display: flex; gap: 1rem; align-items: flex-start; overflow-x: auto; padding-bottom: 1rem; }
.tlist { width: 380px; flex: none; padding: 1rem 0 .6rem; max-height: calc(100vh - 160px); display: flex; flex-direction: column; }
.tlist h3 { font-weight: 400; font-size: 1.15rem; padding: 0 1.2rem .4rem; display: flex; align-items: center; justify-content: space-between; }
.tlist .tbody { overflow-y: auto; }
.addtask { display: flex; align-items: center; gap: .7rem; padding: .5rem 1.2rem; color: var(--primary); cursor: pointer; font-weight: 500; border: 0; background: transparent; width: 100%; text-align: left; }
.task { display: flex; gap: .8rem; padding: .55rem 1.2rem; align-items: flex-start; cursor: pointer; }
.task:hover { background: var(--surface-2); }
.circle { width: 1.3rem; height: 1.3rem; border-radius: 50%; border: 2px solid var(--muted); flex: none; margin-top: .15rem; background: transparent; cursor: pointer; display: grid; place-items: center; padding: 0; }
.circle:hover { border-color: var(--primary); }
.circle.done { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); font-size: .7rem; }
.task.done .t-title { text-decoration: line-through; color: var(--muted); }
.t-notes { font-size: .82rem; color: var(--muted); white-space: pre-line; }
.star { color: var(--muted); }
.star.on { color: #d9a43c; }
.done-toggle { padding: .6rem 1.2rem; color: var(--muted); border: 0; background: transparent; cursor: pointer; width: 100%; text-align: left; }
.listtoggles label { display: flex; justify-content: space-between; padding: .45rem 1rem; border-radius: 999px; cursor: pointer; }
.listtoggles label:hover { background: var(--surface-2); }

/* ============ Notizen ============ */
.composer { max-width: 600px; margin: 0 auto 1.6rem; padding: .3rem .4rem .3rem 1rem; display: flex; align-items: center; cursor: text; }
.composer .ph { flex: 1; color: var(--muted); }
.masonry { columns: 260px; column-gap: 1rem; }
.note { break-inside: avoid; margin-bottom: 1rem; padding: .9rem 1rem .4rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; position: relative; box-shadow: none; }
.note:hover { box-shadow: var(--shadow); }
.note h3 { font-size: 1.05rem; margin-bottom: .35rem; padding-right: 1.6rem; }
.note .nbody { white-space: pre-wrap; font-size: .92rem; max-height: 14rem; overflow: hidden; }
.note .pin { position: absolute; top: .4rem; right: .3rem; }
.note .actions { display: flex; gap: .1rem; opacity: .0; transition: opacity .2s; margin-left: -.5rem; }
.note:hover .actions, .note:focus-within .actions { opacity: 1; }
@media (hover: none) { .note .actions { opacity: 1; } }
.citem { display: flex; gap: .55rem; align-items: flex-start; font-size: .92rem; padding: .1rem 0; }
.citem input { margin-top: .3rem; accent-color: var(--primary); }
.citem.done span { text-decoration: line-through; color: var(--muted); }
.thumbs { display: flex; gap: .4rem; flex-wrap: wrap; margin: .5rem 0; }
.thumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; }
.note.c-1 { background: color-mix(in srgb, var(--surface) 80%, #9cc3e6); }
.note.c-2 { background: color-mix(in srgb, var(--surface) 80%, #9fd8cf); }
.note.c-3 { background: color-mix(in srgb, var(--surface) 80%, #b8b5e8); }
.note.c-4 { background: color-mix(in srgb, var(--surface) 80%, #e6d79a); }
.note.c-5 { background: color-mix(in srgb, var(--surface) 82%, #e8b0b0); }
.colors { display: flex; gap: .35rem; }
.colors button { width: 1.6rem; height: 1.6rem; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; }
.colors button.on { border-color: var(--primary); }
.att { display: flex; align-items: center; gap: .5rem; padding: .4rem .6rem; border-radius: 10px; background: var(--surface-2); font-size: .85rem; }
.att audio { height: 32px; max-width: 220px; }
.rec { display: flex; align-items: center; gap: .6rem; padding: .5rem .8rem; border-radius: 12px; background: var(--primary-soft); }
.rec .dot { width: .7rem; height: .7rem; border-radius: 50%; background: var(--danger); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.interim { color: var(--muted); font-style: italic; min-height: 1.2rem; font-size: .88rem; }
.edit-items .ei { display: flex; gap: .4rem; align-items: center; margin-bottom: .3rem; }
.edit-items .ei input[type=text] { padding: .35rem .6rem; }

/* ============ Tagebuch ============ */
.diary { display: grid; grid-template-columns: 300px 1fr; gap: 1.4rem; min-height: 70vh; }
.dlist { display: flex; flex-direction: column; gap: .3rem; }
.dday { padding: .6rem .8rem; border-radius: 14px; cursor: pointer; border: 1px solid transparent; }
.dday:hover { background: var(--surface-2); }
.dday.on { border-color: var(--line); background: var(--primary-soft); }
.dday .ex { font-size: .82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deditor { padding: 1.4rem 1.6rem; }
.deditor h2 { font-weight: 300; font-size: 1.8rem; margin-bottom: .2rem; }
.deditor textarea { min-height: 50vh; border: 0; padding: 0; font-size: 1.05rem; line-height: 1.75; background: transparent; box-shadow: none; }
.moods button { font-size: 1.4rem; border: 0; background: transparent; border-radius: 50%; width: 2.6rem; height: 2.6rem; cursor: pointer; opacity: .45; }
.moods button.on { opacity: 1; background: var(--primary-soft); }

/* ============ Einkaufslisten ============ */
.shop { display: grid; grid-template-columns: 280px 1fr; gap: 1.4rem; }
.shop-lists { display: flex; flex-direction: column; gap: .4rem; }
.slist { padding: .75rem 1rem; border-radius: 14px; cursor: pointer; display: flex; gap: .7rem; align-items: center; }
.slist:hover { background: var(--surface-2); }
.slist.on { background: var(--primary-soft); }
.shop-main { padding: 1.2rem 1.4rem; max-width: 720px; }
.sitem { display: flex; align-items: center; gap: .8rem; padding: .7rem .4rem; border-bottom: 1px solid var(--line); }
.sitem .txt { flex: 1; font-size: 1.02rem; }
.sitem.done .txt { text-decoration: line-through; color: var(--muted); }
.sitem input[type=checkbox] { width: 1.35rem; height: 1.35rem; accent-color: var(--primary); }

/* ============ Dateien ============ */
.fm { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.pane { border: 1px solid var(--line); border-radius: 18px; display: flex; flex-direction: column; min-height: 60vh; background: var(--surface); position: relative; }
.pane.drop { outline: 3px dashed var(--primary); outline-offset: -6px; }
.pane-head { padding: .7rem .8rem; border-bottom: 1px solid var(--line); display: grid; gap: .5rem; }
.crumbs { display: flex; flex-wrap: wrap; gap: .1rem; font-size: .88rem; }
.crumbs button { border: 0; background: transparent; padding: .15rem .35rem; border-radius: 6px; cursor: pointer; color: var(--primary); }
.crumbs button:hover { background: var(--surface-2); }
.flist { overflow: auto; flex: 1; }
.frow { display: grid; grid-template-columns: 1.6rem 1.6rem 1fr 6rem 9rem; gap: .5rem; align-items: center; padding: .45rem .8rem; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); cursor: default; font-size: .9rem; }
.frow:hover { background: var(--surface-2); }
.frow.sel { background: var(--primary-soft); }
.frow .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.frow .fsize, .frow .fdate { color: var(--muted); font-size: .8rem; text-align: right; }
.progress { height: 4px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.progress div { height: 100%; background: var(--primary); width: 0; transition: width .2s; }
.pane-tools { display: flex; flex-wrap: wrap; gap: .3rem; }

/* ============ Start ============ */
.hello { font-size: 2rem; font-weight: 300; margin-bottom: .2rem; }
.dash { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.2rem; margin-top: 1.4rem; }
.dash .card { padding: 1.1rem 1.2rem; }
.dash h3 { font-size: 1rem; margin-bottom: .7rem; display: flex; justify-content: space-between; align-items: center; }
.server-btns { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .8rem; margin-top: 1.2rem; }
.server-btn { display: flex; flex-direction: column; gap: .5rem; padding: 1rem 1.1rem; border-radius: 18px; background: var(--primary-soft); border: 0; cursor: pointer; text-align: left; color: var(--text); text-decoration: none; }
.server-btn:hover { background: color-mix(in srgb, var(--primary-soft) 70%, var(--primary)); }
.server-btn .si { font-size: 1.5rem; }
.server-btn small { color: var(--muted); }
.agenda-item { display: grid; grid-template-columns: 4.6rem 1fr; gap: .6rem; padding: .35rem 0; font-size: .92rem; }

/* ============ Einstellungen ============ */
.tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: 1.2rem; border-bottom: 1px solid var(--line); }
.tabs a { padding: .6rem 1rem; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--text); border-color: var(--primary); }
.set-section { max-width: 760px; }
.set-section h3 { margin: 1.4rem 0 .6rem; font-size: 1.05rem; }
.palettes { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .7rem; }
.pal { border: 2px solid var(--line); border-radius: 16px; padding: .6rem; cursor: pointer; background: var(--surface); text-align: left; }
.pal.on { border-color: var(--primary); }
.pal .sw { display: flex; height: 2.4rem; border-radius: 10px; overflow: hidden; margin-bottom: .4rem; }
.pal .sw span { flex: 1; }
.mrow { display: flex; align-items: center; gap: .5rem; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 12px; margin-bottom: .4rem; background: var(--surface); }
.mrow input[type=text] { padding: .35rem .6rem; }
.mrow .emoji { width: 3.2rem; text-align: center; }
.srv { padding: 1rem; border: 1px solid var(--line); border-radius: 16px; margin-bottom: .8rem; }
.integ { padding: 1.2rem; border: 1px solid var(--line); border-radius: 18px; margin-bottom: 1rem; }
.integ h3 { margin: 0 0 .3rem; }
.dirsel { display: grid; grid-template-columns: 9rem 1fr; gap: .5rem; align-items: center; margin: .3rem 0; }
.ok { color: var(--ok); }
.err { color: var(--danger); white-space: pre-wrap; font-size: .85rem; }
code, .mono { font-family: ui-monospace, 'Cascadia Mono', Menlo, monospace; font-size: .85em; background: var(--surface-2); padding: .1rem .35rem; border-radius: 6px; word-break: break-all; }
table.simple { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.simple td, table.simple th { padding: .5rem; border-bottom: 1px solid var(--line); text-align: left; font-weight: 400; }
table.simple th { color: var(--muted); font-size: .8rem; }

/* ============ Modal & Toast ============ */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 30, 50, .35); display: grid; place-items: center; z-index: 100; padding: 1rem; animation: fade .2s ease; }
.modal { background: var(--surface); border-radius: 22px; box-shadow: 0 24px 60px rgba(10, 25, 45, .25); width: min(560px, 100%); max-height: 92vh; overflow: auto; padding: 1.4rem 1.5rem; animation: rise .25s ease; }
.modal.wide { width: min(760px, 100%); }
.modal h2 { font-weight: 400; font-size: 1.3rem; margin-bottom: 1rem; }
.modal .foot { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.2rem; flex-wrap: wrap; }
.modal .foot .left { margin-right: auto; display: flex; gap: .2rem; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
#toasts { position: fixed; bottom: calc(1.2rem + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); display: grid; gap: .5rem; z-index: 200; }
.toast { background: var(--text); color: var(--bg); padding: .7rem 1.2rem; border-radius: 14px; box-shadow: var(--shadow); animation: rise .25s ease; max-width: 90vw; }
.toast.error { background: var(--danger); color: #fff; }

/* ============ Responsiv ============ */
@media (max-width: 1100px) {
  .fm { grid-template-columns: 1fr; }
  .frow { grid-template-columns: 1.6rem 1.6rem 1fr 5rem; }
  .frow .fdate { display: none; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: 290px; background: var(--bg); z-index: 60; transform: translateX(-105%); transition: transform .3s ease; padding-top: calc(1rem + env(safe-area-inset-top, 0px)); box-shadow: var(--shadow); }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(15, 30, 50, .3); z-index: 55; }
  .main { border-radius: 0; grid-column: 1; }
  .brand { min-width: 0; }
  .brand { display: none; }
  .topbar { gap: .2rem; }
  .shop-main h2 { font-size: 1.25rem; }
  .searchbox { width: auto; flex: 1; }
  .top-tools h2 { font-size: 1.05rem; }
  .page { padding: 1rem .9rem 3rem; }
  .diary, .shop { grid-template-columns: 1fr; }
  .tlist { width: 88vw; }
  .month { grid-template-columns: 1.4rem repeat(7, 1fr); grid-auto-rows: minmax(84px, 1fr); min-height: 520px; }
  .ev { font-size: .66rem; padding: .05rem .25rem; }
  .ev.timed::before { display: none; }
  .grid2 { grid-template-columns: 1fr; }
  .hide-m { display: none !important; }
  .dirsel { grid-template-columns: 1fr; }
}
@media (min-width: 861px) { .show-m { display: none !important; } }

/* ============ Verwaltung & App ============ */
.lockfs { border: 0; padding: 0; margin: 0; min-width: 0; }
.lockfs.locked #tab { opacity: .6; transition: opacity .3s ease; }
.lockfs:not(.locked) #tab { transition: opacity .3s ease; }
.linkbtn { border: 0; background: transparent; color: var(--muted); font-size: .78rem; cursor: pointer; padding: .3rem; margin-top: -.3rem; justify-self: center; text-decoration: underline; text-underline-offset: 3px; }
.linkbtn:hover { color: var(--primary); }
.navsep { border: 0; border-top: 1px solid var(--line); margin: .5rem 1rem; }

/* ============ Kopfzeile: Uhr & Kontomenü ============ */
.clock { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; padding: 0 .4rem; color: var(--muted); font-size: .74rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.clock .c-time { font-size: .95rem; color: var(--text); }
.avwrap { position: relative; }
.avmenu { position: absolute; right: 0; top: calc(100% + 8px); width: 240px; padding: .4rem; z-index: 50; display: grid; }
.avmenu a, .avmenu .navlink { display: flex; gap: .6rem; padding: .55rem .8rem; border-radius: 10px; text-decoration: none; color: var(--text); border: 0; background: transparent; cursor: pointer; text-align: left; font-size: .92rem; }
.avmenu a:hover, .avmenu .navlink:hover { background: var(--surface-2); }
.avhead { padding: .5rem .8rem .6rem; display: grid; }
.avhead strong { font-weight: 500; }
.sidebar { min-height: 0; }
.side-bottom { margin-top: auto; padding-top: 1rem; }
.logview { background: var(--surface-2); border-radius: 14px; padding: .9rem 1rem; max-height: 60vh; overflow: auto; font-family: ui-monospace, 'Cascadia Mono', Menlo, monospace; font-size: .78rem; line-height: 1.55; white-space: pre-wrap; word-break: break-word; margin: 0; }
.logview .l-crash { color: var(--danger); font-weight: 600; }
.logview .l-err { color: var(--danger); }
.logview .l-warn { color: #b98a2e; }
@media (max-width: 860px) { .clock { padding: 0 .1rem; } }
/* Auf dem Handy zeigt die Statusleiste die Uhrzeit bereits – Platz für den Seitentitel */
@media (max-width: 600px) { .clock { display: none; } .top-tools h2 { min-width: 6.5rem; } }
