/* Tätigkeitentracker – freundliches, ruhiges UI */
:root {
  --bg: #f5f6fb;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, #eceefe 0%, transparent 60%), radial-gradient(900px 500px at -10% 110%, #fdf1ea 0%, transparent 55%);
  --panel: #ffffff;
  --panel-2: #f7f8fc;
  --hover: #f1f2fa;
  --text: #1f2437;
  --text-2: #4a5068;
  --muted: #8a90a6;
  --line: #eaecf4;
  --line-2: #dfe2ee;
  --accent: #5b61f0;
  --accent-2: #6f75f5;
  --accent-ink: #4348d1;
  --accent-soft: #eef0ff;
  --accent-grad: linear-gradient(135deg, #6a70f7 0%, #8a63f2 100%);
  --ok: #129a6e;
  --ok-soft: #e4f7ef;
  --warn: #b7791f;
  --warn-soft: #fdf3e1;
  --danger: #d6455d;
  --danger-soft: #fdebee;
  --violet: #7c5cf0;
  --violet-soft: #f1ecff;
  --sky: #2b8fd6;
  --sky-soft: #e5f3fd;
  --note: #fffaeb;
  --note-line: #f3dc92;
  --shadow-sm: 0 1px 2px rgba(31, 36, 55, .04), 0 1px 3px rgba(31, 36, 55, .05);
  --shadow: 0 2px 6px rgba(31, 36, 55, .04), 0 8px 24px rgba(31, 36, 55, .06);
  --shadow-lg: 0 24px 60px rgba(31, 36, 55, .18);
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;
  --av-l: 93%;
  --av-ink: 36%;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12131a; --bg-grad: radial-gradient(1000px 500px at 100% -10%, #1d1f35 0%, transparent 60%);
    --panel: #1a1c26; --panel-2: #20222e; --hover: #242735; --text: #eceef6; --text-2: #c2c6d6; --muted: #8b90a5;
    --line: #2a2d3b; --line-2: #343849; --accent: #8a8ff9; --accent-2: #a0a4fb; --accent-ink: #b4b7ff; --accent-soft: #262a4a;
    --accent-grad: linear-gradient(135deg, #6a70f7 0%, #8a63f2 100%);
    --ok: #4fd1a1; --ok-soft: #173229; --warn: #f2c26b; --warn-soft: #362b17; --danger: #f47d90; --danger-soft: #3a1d25;
    --violet: #b39cff; --violet-soft: #2c2448; --sky: #72bdf2; --sky-soft: #1a2c3d; --note: #2b2716; --note-line: #5e5122;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.3); --shadow: 0 2px 8px rgba(0,0,0,.35); --shadow-lg: 0 24px 60px rgba(0,0,0,.55);
    --av-l: 26%; --av-ink: 80%;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg-grad), var(--bg); background-attachment: fixed; color: var(--text);
  font: 14.5px/1.5 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { color: var(--accent); }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin: 0; }
h2 { font-size: 16px; font-weight: 650; margin: 0 0 12px; letter-spacing: -.01em; }
h3 { font-size: 14px; font-weight: 650; margin: 0 0 10px; }
code { background: var(--panel-2); padding: 1px 5px; border-radius: 5px; font-size: 12.5px; }
::selection { background: var(--accent-soft); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mono { font-variant-numeric: tabular-nums; }
.grow { flex: 1; }
svg.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.btn.small svg.ic { width: 15px; height: 15px; }

/* ─── Layout ─────────────────────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: color-mix(in srgb, var(--panel) 80%, transparent); backdrop-filter: blur(12px); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 14px 12px; }
.sidebar nav { display: flex; flex-direction: column; gap: 3px; flex: 1; margin-top: 10px; }
.sidebar nav a { padding: 10px 12px; border-radius: 11px; color: var(--text-2); display: flex; align-items: center; gap: 12px; font-weight: 500; transition: background .15s, color .15s; }
.sidebar nav a svg.ic { color: var(--muted); transition: color .15s; }
.sidebar nav a:hover { background: var(--hover); color: var(--text); }
.sidebar nav a.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 650; }
.sidebar nav a.active svg.ic { color: var(--accent); }
.sidebar nav a .badge { margin-left: auto; }
.sidebar-foot { padding: 12px 8px 4px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.sidebar-foot .who { flex: 1; min-width: 0; line-height: 1.25; }
.sidebar-foot .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; padding: 6px 10px; font-size: 16px; letter-spacing: -.01em; }
.brand img { width: 30px; height: 30px; border-radius: 9px; box-shadow: 0 4px 12px rgba(91, 97, 240, .3); }
.brand small { display: block; font-weight: 500; font-size: 11.5px; color: var(--muted); letter-spacing: 0; }
.topbar { display: none; }
.view { padding: 32px 36px 48px; max-width: 1360px; width: 100%; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin-right: auto; }
.page-head .sub { display: block; font-size: 14px; font-weight: 400; color: var(--muted); letter-spacing: 0; margin-top: 2px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 500; margin-bottom: 8px; }
.back:hover { color: var(--accent); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; width: 264px; transform: translateX(-105%); transition: transform .22s ease; box-shadow: var(--shadow-lg); background: var(--panel); }
  .sidebar.open { transform: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: color-mix(in srgb, var(--panel) 85%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
  .topbar .brand { padding: 0; font-size: 15px; }
  .topbar .brand img { width: 26px; height: 26px; }
  .view { padding: 20px 16px 40px; }
  h1 { font-size: 21px; }
}

/* ─── Controls ───────────────────────────────────────────────────────────── */
.btn { border: 1px solid var(--line-2); background: var(--panel); color: var(--text); border-radius: 11px; padding: 8px 14px; font: inherit; font-weight: 550; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; box-shadow: var(--shadow-sm); transition: background .15s, border-color .15s, box-shadow .15s, transform .05s; }
.btn:hover { background: var(--hover); border-color: var(--line-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 1px; }
.btn.primary { background: var(--accent-grad); border-color: transparent; color: #fff; box-shadow: 0 4px 14px rgba(91, 97, 240, .28); }
.btn.primary:hover { filter: brightness(1.06); box-shadow: 0 6px 18px rgba(91, 97, 240, .36); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: transparent; }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--hover); }
.btn.small { padding: 5px 10px; font-size: 13px; border-radius: 9px; }
.btn.icon { padding: 8px; }
.btn.icon.small { padding: 5px; }
.btn.ai { background: var(--violet-soft); border-color: transparent; color: var(--violet); box-shadow: none; }
.btn.ai:hover { filter: brightness(.97); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.month-nav { display: inline-flex; align-items: center; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 3px; box-shadow: var(--shadow-sm); }
.month-nav .btn { box-shadow: none; border: 0; padding: 6px 8px; background: transparent; }
.month-nav .btn:hover { background: var(--hover); }
.month-nav b { min-width: 150px; text-align: center; font-weight: 600; }

input, select, textarea { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line-2); border-radius: 11px; padding: 9px 12px; width: 100%; transition: border-color .15s, box-shadow .15s; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line-2)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 4px var(--accent-soft); }
input:disabled, select:disabled, textarea:disabled { background: var(--panel-2); color: var(--muted); }
input[readonly] { background: var(--panel-2); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); font-weight: 550; }
label.check { flex-direction: row; align-items: center; gap: 10px; color: var(--text); font-size: 14.5px; font-weight: 450; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-all { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid .span-2 { grid-column: 1 / -1; } }
.search { position: relative; max-width: 280px; flex: 1 1 200px; }
.search > svg.ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.search input { padding-left: 34px; }

.segmented { display: inline-flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; }
.segmented button { border: 0; background: transparent; padding: 6px 14px; font: inherit; font-weight: 550; color: var(--text-2); cursor: pointer; border-radius: 9px; transition: background .15s, color .15s; }
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--panel); color: var(--accent-ink); box-shadow: var(--shadow-sm); }

/* ─── Cards / tables ─────────────────────────────────────────────────────── */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 20px; }
.card + .card { margin-top: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 18px; align-items: start; }
@media (max-width: 480px) { .grid-2 { grid-template-columns: 1fr; } }

.hello { margin-bottom: 22px; }
.hello h1 { font-size: 28px; }
.hello p { margin: 4px 0 0; color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 22px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow); display: flex; gap: 14px; align-items: center; }
.kpi .ico { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; flex: none; }
.kpi .ico svg.ic { width: 22px; height: 22px; }
.kpi .v { font-size: 25px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi .v small { font-size: 14px; font-weight: 550; color: var(--muted); margin-left: 3px; }
.kpi .l { color: var(--muted); font-size: 13px; }
.tone-accent { background: var(--accent-soft); color: var(--accent); }
.tone-ok { background: var(--ok-soft); color: var(--ok); }
.tone-violet { background: var(--violet-soft); color: var(--violet); }
.tone-warn { background: var(--warn-soft); color: var(--warn); }
.tone-sky { background: var(--sky-soft); color: var(--sky); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--panel-2); letter-spacing: .01em; }
tbody tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; transition: background .12s; }
tr.clickable:hover td { background: var(--hover); }
tr.unread td { font-weight: 650; }
tfoot td { font-weight: 700; border-top: 1px solid var(--line-2); border-bottom: 0; background: var(--panel-2); }
td .cell-main { display: flex; align-items: center; gap: 12px; }
td input { padding: 7px 10px; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty svg.ic { width: 34px; height: 34px; color: var(--line-2); stroke-width: 1.5; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--panel-2); color: var(--text-2); white-space: nowrap; line-height: 1.4; }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.open { background: var(--accent-soft); color: var(--accent-ink); }
.badge.paused { background: var(--warn-soft); color: var(--warn); }
.badge.closed, .badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.high { background: var(--danger-soft); color: var(--danger); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }
.badge svg.ic { width: 13px; height: 13px; }
#nav-unread { background: var(--danger); color: #fff; min-width: 22px; justify-content: center; padding: 1px 7px; }
.unread-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 8px; vertical-align: middle; box-shadow: 0 0 0 3px var(--accent-soft); }

.avatar { --h: 230; width: 36px; height: 36px; border-radius: 12px; display: inline-grid; place-items: center; flex: none; font-weight: 700; font-size: 13px; letter-spacing: .02em; background: hsl(var(--h) 70% var(--av-l)); color: hsl(var(--h) 50% var(--av-ink)); }
.avatar.sm { width: 28px; height: 28px; border-radius: 9px; font-size: 11px; }
.avatar.round { border-radius: 50%; }

/* ─── Zeiten ─────────────────────────────────────────────────────────────── */
.day-group { margin-bottom: 20px; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 6px 8px; font-weight: 650; color: var(--text-2); font-size: 13.5px; }
.day-head .mono { color: var(--muted); font-weight: 600; }
.entry { display: grid; grid-template-columns: auto 104px 64px 1fr auto; gap: 14px; padding: 13px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; cursor: pointer; align-items: center; box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s, transform .15s; }
.entry:hover { border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); box-shadow: var(--shadow); transform: translateY(-1px); }
.entry .t { color: var(--text-2); font-size: 13.5px; }
.entry .d { font-weight: 700; }
.entry .who { font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.entry .who .sub { font-weight: 450; color: var(--muted); }
.entry .desc { white-space: pre-wrap; color: var(--text-2); margin-top: 2px; font-size: 13.5px; }
.entry .desc.raw { font-style: italic; color: var(--muted); }
.entry.nonbill { background: var(--panel-2); }
@media (max-width: 700px) {
  .entry { grid-template-columns: auto 1fr auto; }
  .entry .t { grid-column: 2; grid-row: 1; }
  .entry .d { grid-column: 3; grid-row: 1; text-align: right; }
  .entry > .body { grid-column: 1 / -1; }
  .entry > .flags { display: none; }
}

/* ─── Tickets ────────────────────────────────────────────────────────────── */
.ticket-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .ticket-layout { grid-template-columns: 1fr; } }
.ticket-title { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.ticket-title .num { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; background: var(--panel-2); border: 1px solid var(--line); padding: 2px 9px; border-radius: 8px; font-size: 13px; }
.ticket-title h1 { cursor: text; border-radius: 8px; padding: 0 4px; margin-left: -4px; }
.ticket-title h1:hover { background: var(--hover); }
.actions-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 22px; }
.actions-bar .sep { width: 1px; background: var(--line-2); margin: 4px 2px; }
.msg { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); margin-bottom: 14px; overflow: hidden; box-shadow: var(--shadow); }
.msg.out { border-color: color-mix(in srgb, var(--ok) 25%, var(--line)); }
.msg.note { background: var(--note); border-color: var(--note-line); box-shadow: none; }
.msg-head { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; padding: 14px 18px; flex-wrap: wrap; }
.msg-from { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.msg-meta { font-size: 13px; color: var(--muted); line-height: 1.45; min-width: 0; word-break: break-word; }
.msg-meta b { color: var(--text); font-weight: 650; }
.msg-meta .subj { color: var(--text); font-weight: 600; margin-top: 3px; display: block; }
.msg-actions { display: flex; gap: 4px; align-items: center; }
.msg-actions .when { font-size: 12.5px; color: var(--muted); margin-right: 6px; }
.msg-body { border-top: 1px solid var(--line); }
.msg.note .msg-body { border-top-color: var(--note-line); }
.msg-body iframe { width: 100%; border: 0; display: block; min-height: 60px; background: #fff; }
.msg-body .note-text { padding: 12px 18px 16px; white-space: pre-wrap; }
.msg-atts { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--panel-2); }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border: 1px solid var(--line-2); border-radius: 999px; font-size: 13px; background: var(--panel); color: var(--text); transition: border-color .15s; }
.chip:hover { border-color: var(--accent-2); color: var(--accent-ink); }
.chip svg.ic { width: 14px; height: 14px; color: var(--muted); }
.side-section { margin-bottom: 18px; }
.side-section:last-child { margin-bottom: 0; }
.kv { display: grid; grid-template-columns: 104px 1fr; gap: 8px 12px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; display: flex; gap: 12px; align-items: center; }
.mini-list li:first-child { padding-top: 2px; }
.mini-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.mini-list .li-main { min-width: 0; flex: 1; }
.mini-list .li-title { font-weight: 600; color: var(--text); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-list a.li-title:hover { color: var(--accent); }
.side-section .entry { grid-template-columns: auto 1fr auto; gap: 6px 10px; padding: 11px 12px; }
.side-section .entry > .body { grid-column: 1 / -1; }
.side-section .entry > .flags { display: none; }
.side-section .entry .who .sub { display: none; }

/* ─── Kalender ───────────────────────────────────────────────────────────── */
.cal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.cal-day { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px; box-shadow: var(--shadow-sm); min-height: 96px; }
.cal-day h3 { color: var(--text-2); font-size: 13px; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.cal-day h3 .dnum { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: var(--panel-2); font-size: 14px; color: var(--text); }
.cal-day.today { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); box-shadow: 0 0 0 3px var(--accent-soft); }
.cal-day.today h3 .dnum { background: var(--accent-grad); color: #fff; }
.cal-day.weekend { background: var(--panel-2); }
.cal-item { display: flex; gap: 10px; padding: 9px 11px; border-radius: 11px; background: var(--accent-soft); margin-bottom: 6px; align-items: flex-start; border-left: 3px solid var(--accent); }
.cal-item.m365 { background: var(--panel-2); border-left-color: var(--line-2); }
.cal-item.clickable { cursor: pointer; }
.cal-item.clickable:hover { filter: brightness(.98); }
.cal-item .time { font-size: 12.5px; font-weight: 650; color: var(--text-2); white-space: nowrap; min-width: 86px; }
.cal-item .what { flex: 1; min-width: 0; font-size: 13.5px; }
.cal-item .what b { font-weight: 600; }
.cal-none { color: var(--muted); font-size: 13px; padding: 2px 2px 4px; }

/* ─── Modal ──────────────────────────────────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(24, 26, 40, .38); backdrop-filter: blur(4px); display: flex; align-items: flex-start; justify-content: center; z-index: 100; padding: 6vh 14px; overflow-y: auto; animation: fadeIn .15s ease; }
@keyframes fadeIn { from { opacity: 0; } }
.modal { background: var(--panel); border-radius: 20px; width: 100%; max-width: 740px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: pop .2s cubic-bezier(.2, .9, .3, 1.2); border: 1px solid var(--line); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal.wide { max-width: 1040px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 6px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-body { padding: 14px 22px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; background: var(--panel-2); border-radius: 0 0 20px 20px; }
.modal-foot .left { margin-right: auto; }
.ai-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 12px; background: var(--violet-soft); border-radius: 12px; }
.ai-row .hint { font-size: 12.5px; color: var(--violet); opacity: .85; }
.ai-row .btn.ai { background: var(--panel); }
.duration-pill { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; color: var(--accent-ink); background: var(--accent-soft); padding: 9px 12px; border-radius: 11px; font-variant-numeric: tabular-nums; }
.duration-pill.bad { color: var(--danger); background: var(--danger-soft); }

/* ─── Login ──────────────────────────────────────────────────────────────── */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(800px 500px at 15% 10%, #e7e8ff 0%, transparent 60%), radial-gradient(700px 500px at 90% 90%, #fde8dd 0%, transparent 60%), var(--bg); }
@media (prefers-color-scheme: dark) { .login { background: radial-gradient(800px 500px at 15% 10%, #22254a 0%, transparent 60%), var(--bg); } }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 24px; padding: 34px 32px; width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 16px; box-shadow: var(--shadow-lg); }
.login-card .brand { padding: 0; font-size: 18px; }
.login-card .brand img { width: 40px; height: 40px; border-radius: 12px; }
.login-card h1 { font-size: 22px; margin-top: 8px; }
.login-card p.lead { margin: -8px 0 4px; color: var(--muted); }
.login-card .btn { padding: 11px; font-size: 15px; }
.error { color: var(--danger); margin: 0; min-height: 1em; font-size: 13px; }

/* ─── Toasts / Hinweise ─────────────────────────────────────────────────── */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 200; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--panel); color: var(--text); padding: 12px 16px 12px 14px; border-radius: 14px; box-shadow: var(--shadow-lg); font-size: 14px; border: 1px solid var(--line); border-left: 4px solid var(--accent); animation: pop .2s ease; }
.toast.error { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--ok); }
.alert { padding: 12px 14px; border-radius: 12px; font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; }
.alert svg.ic { margin-top: 1px; }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.info { background: var(--accent-soft); color: var(--accent-ink); }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.spinner { display: inline-block; width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.view > .empty .spinner { width: 26px; height: 26px; color: var(--accent); border-width: 3px; margin-top: 60px; }
@keyframes spin { to { transform: rotate(360deg); } }
.hint-text { color: var(--muted); font-size: 13px; margin: 14px 4px 0; }
.avatar.tone-accent { background: var(--accent-soft); color: var(--accent); }
.avatar.tone-ok { background: var(--ok-soft); color: var(--ok); }
.avatar.tone-violet { background: var(--violet-soft); color: var(--violet); }
.avatar.tone-warn { background: var(--warn-soft); color: var(--warn); }
.avatar.tone-sky { background: var(--sky-soft); color: var(--sky); }
.avatar svg.ic { width: 16px; height: 16px; }
.avatar.sm svg.ic { width: 14px; height: 14px; }
td .btn-row { flex-wrap: nowrap; }
@media (max-width: 700px) { .actions-bar .sep { display: none; } }
input[type=file] { padding: 6px; color: var(--muted); font-size: 13px; }
input[type=file]::file-selector-button { font: inherit; font-weight: 600; border: 0; border-radius: 8px; padding: 6px 12px; margin-right: 10px; background: var(--accent-soft); color: var(--accent-ink); cursor: pointer; }
input[type=file]::file-selector-button:hover { filter: brightness(.97); }

/* ─── Stoppuhr ───────────────────────────────────────────────────────────── */
.timer-pill { display: flex; align-items: center; gap: 8px; margin: 10px 4px 0; padding: 8px 8px 8px 12px; border-radius: 14px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.timer-pill .timer-main { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.2; }
.timer-pill .timer-main b { font-size: 16px; color: var(--accent-ink); }
.timer-pill .timer-what { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timer-pill .btn.small { padding: 5px 7px; }
.timer-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); flex: none; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 45%, transparent); } 50% { box-shadow: 0 0 0 5px transparent; } }
.timer-pill.compact { margin: 0 8px 0 auto; padding: 4px 4px 4px 10px; gap: 6px; }
.timer-pill.compact .timer-what, .timer-pill.compact [data-timer-discard] { display: none; }
.timer-pill.compact .timer-main b { font-size: 14px; }

/* ─── Antwort-Dialog ─────────────────────────────────────────────────────── */
.compose-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: -6px; }
.compose-tools .muted { font-weight: 550; color: var(--text-2); font-size: 13px; }
.tpl-select { width: auto; max-width: 280px; padding: 6px 10px; font-size: 13px; background: var(--violet-soft); color: var(--violet); border-color: transparent; font-weight: 550; }
details.orig { border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); overflow: hidden; }
details.orig summary { cursor: pointer; padding: 10px 14px; font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 8px; list-style: none; }
details.orig summary::-webkit-details-marker { display: none; }
details.orig summary::after { content: "›"; margin-left: auto; transition: transform .15s; font-size: 16px; color: var(--muted); }
details.orig[open] summary::after { transform: rotate(90deg); }
details.orig [data-orig] { border-top: 1px solid var(--line); max-height: 320px; overflow: auto; }
.tpl-preview { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }

/* ─── 2FA ────────────────────────────────────────────────────────────────── */
.setup-2fa { display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: start; }
@media (max-width: 560px) { .setup-2fa { grid-template-columns: 1fr; justify-items: center; } }
.setup-2fa .qr { background: #fff; padding: 10px; border-radius: 14px; border: 1px solid var(--line); line-height: 0; }
.setup-2fa .qr svg { width: 180px; height: 180px; }
.steps { margin: 0 0 12px; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; color: var(--text-2); }
.secret { font-size: 14px; letter-spacing: .06em; display: inline-block; margin-top: 4px; user-select: all; }
.code-input { font-size: 22px; letter-spacing: .3em; text-align: center; max-width: 220px; font-variant-numeric: tabular-nums; }
.recovery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.recovery code { font-size: 15px; padding: 8px; text-align: center; letter-spacing: .05em; user-select: all; }
.login-step { display: flex; flex-direction: column; gap: 14px; }

/* ─── Anmeldung mit Microsoft ────────────────────────────────────────────── */
.ms-btn { gap: 12px; padding: 11px; font-size: 15px; font-weight: 600; background: var(--panel); border-color: var(--line-2); color: var(--text); text-decoration: none; }
.ms-btn:hover { background: var(--hover); color: var(--text); }
.login-or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12.5px; }
.login-or::before, .login-or::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }

/* ─── Homescreen ─────────────────────────────────────────────────────────── */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.tile-wrap { position: relative; }
.tile { position: relative; width: 100%; min-height: 150px; text-align: left; display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 18px; border-radius: 20px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; cursor: pointer;
  box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease, border-color .15s; overflow: hidden; }
.tile::after { content: ""; position: absolute; inset: auto -30px -40px auto; width: 120px; height: 120px; border-radius: 50%; background: var(--t-soft); opacity: .6; transition: transform .25s ease; }
.tile:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(31, 36, 55, .10); border-color: color-mix(in srgb, var(--t) 30%, var(--line)); }
.tile:hover::after { transform: scale(1.15); }
.tile:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }
.tile-ico { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; background: var(--t-soft); color: var(--t); margin-bottom: 10px; position: relative; z-index: 1; }
.tile-ico svg.ic { width: 24px; height: 24px; }
.tile-title { font-weight: 700; font-size: 16.5px; letter-spacing: -.01em; position: relative; z-index: 1; }
.tile-info { color: var(--muted); font-size: 13px; line-height: 1.4; position: relative; z-index: 1; }
.tile-info b { color: var(--text-2); font-weight: 650; }
.tile-badge { position: absolute; top: 16px; right: 16px; min-width: 26px; height: 26px; padding: 0 8px; border-radius: 999px; display: grid; place-items: center;
  background: var(--danger); color: #fff; font-weight: 700; font-size: 13px; z-index: 1; box-shadow: 0 0 0 4px var(--panel); }
.tile-badge.warn { background: var(--warn); }
.tile.tone-accent { --t: var(--accent); --t-soft: var(--accent-soft); }
.tile.tone-sky { --t: var(--sky); --t-soft: var(--sky-soft); }
.tile.tone-ok { --t: var(--ok); --t-soft: var(--ok-soft); }
.tile.tone-violet { --t: var(--violet); --t-soft: var(--violet-soft); }
.tile.tone-warn { --t: var(--warn); --t-soft: var(--warn-soft); }
.tile.tone-danger { --t: var(--danger); --t-soft: var(--danger-soft); }
.tile.tone-neutral { --t: var(--text-2); --t-soft: var(--panel-2); }
.tile.running { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.tile.running .tile-ico { background: var(--danger); color: #fff; animation: pulse 1.6s ease-in-out infinite; }
.tiles.editing .tile { cursor: default; transform: none; animation: wiggle .35s ease; }
.tiles.editing .tile-wrap.is-hidden .tile { opacity: .45; filter: grayscale(.6); border-style: dashed; box-shadow: none; }
@keyframes wiggle { 0% { transform: rotate(0); } 30% { transform: rotate(-.6deg); } 60% { transform: rotate(.6deg); } 100% { transform: rotate(0); } }
.tile-edit { position: absolute; left: 50%; bottom: -14px; transform: translateX(-50%); display: flex; gap: 4px; background: var(--panel);
  border: 1px solid var(--line-2); border-radius: 12px; padding: 3px; box-shadow: var(--shadow); z-index: 2; }
.tile-edit .btn { box-shadow: none; border: 0; }
.tiles.editing { row-gap: 30px; }
@media (max-width: 560px) {
  .tiles { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .tile { min-height: 128px; padding: 14px; border-radius: 18px; }
  .tile-ico { width: 40px; height: 40px; border-radius: 12px; margin-bottom: 6px; }
  .tile-title { font-size: 15px; }
  .tile-info { font-size: 12px; }
}

/* ─── Suche ──────────────────────────────────────────────────────────────── */
.search-trigger { display: flex; align-items: center; gap: 10px; margin: 12px 4px 0; padding: 9px 12px; border-radius: 11px; border: 1px solid var(--line-2);
  background: var(--panel); color: var(--muted); font: inherit; cursor: pointer; text-align: left; transition: border-color .15s; }
.search-trigger:hover { border-color: var(--accent-2); color: var(--text-2); }
.search-trigger span:nth-child(2) { flex: 1; }
.search-trigger [data-icon] { display: inline-flex; }
kbd { font: 600 11px/1 "Segoe UI", system-ui, sans-serif; padding: 3px 6px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--muted); }
.modal.search { max-width: 640px; }
.modal.search .modal-head { display: none; }
.modal.search .modal-body { padding: 14px; gap: 10px; }
.search.big { max-width: none; flex: none; }
.search.big input { font-size: 16px; padding: 13px 14px 13px 42px; border-radius: 14px; }
.search.big > svg.ic { left: 14px; width: 19px; height: 19px; }
.search-results { max-height: min(60vh, 460px); overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.sr-group { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 10px 10px 4px; }
.sr-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 12px; border: 0; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.sr-item.active { background: var(--accent-soft); }
.sr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.sr-main b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-main .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-hint { display: flex; gap: 16px; justify-content: flex-end; padding: 4px 6px 0; }
.search-hint kbd { margin-right: 3px; }
@media (max-width: 560px) { .search-hint { display: none; } }
