/* Mein RUDI – Vollbild-Chat + Kacheln (Phase 1+2) */
@import url('/shared/fonts/inter.css');

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: linear-gradient(145deg, #eef2f7 0%, #e4ecf4 25%, #dfe8f0 50%, #e8eef5 75%, #f0f4f8 100%);
  --nav-bg: rgba(255,255,255,0.55);
  --nav-border: rgba(255,255,255,0.5);
  --card-bg: rgba(255,255,255,0.55);
  --card-border: rgba(255,255,255,0.65);
  --card-hover-bg: rgba(255,255,255,0.75);
  --card-shadow: 0 2px 16px rgba(0,0,0,0.04);
  --card-hover-shadow: 0 12px 44px rgba(0,0,0,0.08);
  --chat-bubble-user: rgba(4,179,214,0.16);
  --chat-bubble-rudi: rgba(255,255,255,0.7);
  --text-primary: #1c1c1e;
  --text-secondary: #636366;
  --text-tertiary: #8e8e93;
  --accent: #04b3d6;
  --accent-hover: #0090b0;
  --badge-bg: rgba(4,179,214,0.12);
  --badge-color: #04b3d6;
  --input-bg: rgba(255,255,255,0.75);
  --input-border: rgba(0,0,0,0.08);
  --fade-color: 238,242,247;
}

[data-theme="dark"] {
  --bg: linear-gradient(145deg, #0a0a1a 0%, #0f1528 20%, #151022 40%, #1a0f1e 60%, #12111a 80%, #0d1318 100%);
  --nav-bg: rgba(20,22,30,0.6);
  --nav-border: rgba(255,255,255,0.08);
  --card-bg: rgba(255,255,255,0.08);
  --card-border: rgba(255,255,255,0.12);
  --card-hover-bg: rgba(255,255,255,0.12);
  --card-shadow: 0 2px 16px rgba(0,0,0,0.2);
  --card-hover-shadow: 0 12px 44px rgba(0,0,0,0.3);
  --chat-bubble-user: rgba(4,179,214,0.22);
  --chat-bubble-rudi: rgba(255,255,255,0.08);
  --text-primary: #f5f5f7;
  --text-secondary: #a1a1a6;
  --text-tertiary: #636366;
  --accent: #2cc5e4;
  --accent-hover: #04b3d6;
  --badge-bg: rgba(4,179,214,0.18);
  --badge-color: #2cc5e4;
  --input-bg: rgba(255,255,255,0.06);
  --input-border: rgba(255,255,255,0.1);
  --fade-color: 13,19,24;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
  background: var(--bg);
  background-size: 400% 400%;
  animation: gradientShift 20s ease infinite;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ===== APP-CONTAINER ===== */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 900px;
  margin: 0 auto;
  padding-top: env(safe-area-inset-top);
}

/* ===== NAV ===== */
.topbar {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: var(--nav-bg);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border-bottom: 1px solid var(--nav-border);
  min-height: 58px;
}
.topbar-title { font-size: 17px; font-weight: 700; letter-spacing: -0.4px; line-height: 1.2; }
.topbar-sub { font-size: 12px; color: var(--text-secondary); margin-top: 3px; }
.topbar-actions { display: flex; gap: 6px; flex-shrink: 0; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px;
  border: none; background: transparent; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: background .2s, color .2s;
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover, .icon-btn:active { background: var(--card-hover-bg); color: var(--text-primary); }

/* ===== KACHEL-REIHE ===== */
.cards-wrap {
  flex: 0 0 auto;
  position: relative;
  padding: 12px 0 6px;
  transition: padding .25s ease;
}
.cards {
  display: flex;
  gap: 10px;
  padding: 2px 16px 10px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  max-height: 160px;
  opacity: 1;
  transition: max-height .28s ease, opacity .22s ease, padding .28s ease;
}
.cards::-webkit-scrollbar { display: none; }

/* Fade-out rechts als visueller Scroll-Indikator */
.cards-wrap::after {
  content: '';
  position: absolute;
  top: 12px; bottom: 14px; right: 0;
  width: 24px;
  pointer-events: none;
  background: linear-gradient(to right, rgba(var(--fade-color), 0) 0%, rgba(var(--fade-color), 0.7) 100%);
  transition: opacity .22s ease;
}

/* Toggle-Button unter den Kacheln */
.cards-toggle {
  display: block;
  margin: -4px auto 2px;
  width: 42px; height: 18px;
  border: none; cursor: pointer; padding: 0;
  background: transparent;
  color: var(--text-tertiary);
  border-radius: 10px;
  transition: color .18s, background .18s;
  -webkit-tap-highlight-color: transparent;
}
.cards-toggle:hover, .cards-toggle:active { color: var(--accent); background: var(--card-hover-bg); }
.cards-toggle .chev { transition: transform .28s ease; }

/* Collapsed state */
.cards-wrap.collapsed { padding: 2px 0 2px; }
.cards-wrap.collapsed .cards {
  max-height: 0;
  opacity: 0;
  padding-top: 0; padding-bottom: 0;
  pointer-events: none;
}
.cards-wrap.collapsed::after { opacity: 0; }
.cards-wrap.collapsed .cards-toggle .chev { transform: rotate(180deg); }

.card {
  flex: 0 0 auto;
  width: 160px;
  min-height: 88px;
  padding: 11px 13px;
  background: var(--card-bg);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  scroll-snap-align: start;
  transition: transform .15s, box-shadow .15s, background .2s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  -webkit-tap-highlight-color: transparent;
}
.card:active { transform: scale(.97); }
.card:hover { background: var(--card-hover-bg); box-shadow: var(--card-hover-shadow); }
.card-label { font-size: 10px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.card-title { font-size: 14px; font-weight: 600; color: var(--text-primary); line-height: 1.25; margin-top: 3px; }
.card-value { font-size: 20px; font-weight: 700; color: var(--accent); margin-top: 4px; letter-spacing: -0.5px; }
.card-sub { font-size: 11px; color: var(--text-secondary); margin-top: 4px; line-height: 1.35; }
.card.placeholder { opacity: .5; cursor: default; }
.card.placeholder:active { transform: none; }

/* Top-Mails: wachsende Kachel mit Absender/Subject */
.card.mails {
  width: 260px;
}
.card.mails .mail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 0;
  border-top: 1px solid var(--input-border);
  font-size: 12px;
  line-height: 1.3;
}
.card.mails .mail-item:first-of-type { border-top: none; padding-top: 4px; }
.card.mails .mail-from { font-weight: 600; color: var(--text-primary); }
.card.mails .mail-subj { color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card.mails .count-pill { display: inline-block; background: var(--badge-bg); color: var(--badge-color); font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 6px; margin-left: 6px; }

/* Top-Mails Modal (vollflaechiger Swipe-Stack) */
.mails-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 400;
  display: none;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
}
.mails-overlay.show { display: flex; flex-direction: column; }
.mails-overlay .mails-header {
  width: 100%;
  max-width: 420px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 4px;
  color: #fff;
}
.mails-overlay .mails-header h3 { font-size: 17px; font-weight: 600; }
.mails-overlay .close-btn {
  width: 36px; height: 36px; border-radius: 10px;
  border: none; background: rgba(255,255,255,0.15); color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.mail-stack {
  position: relative;
  width: 100%;
  max-width: 420px;
  flex: 1;
  max-height: 520px;
}
.mail-card {
  position: absolute;
  inset: 0;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  padding: 18px 18px 70px;
  overflow-y: auto;
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  transition: transform .3s ease-out, opacity .3s ease-out;
  will-change: transform, opacity;
  touch-action: pan-y;
}
.mail-card.swipe-left { transform: translateX(-120%) rotate(-12deg); opacity: 0; }
.mail-card.swipe-right { transform: translateX(120%) rotate(12deg); opacity: 0; }
.mail-card .prio-pill { display: inline-block; padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; margin-bottom: 8px; }
.mail-card .prio-pill.p2 { background: rgba(4,179,214,0.15); color: var(--accent); }
.mail-card .prio-pill.p3 { background: rgba(255,59,48,0.15); color: #ff3b30; }
.mail-card .from-line { font-weight: 600; color: var(--text-primary); margin-bottom: 3px; }
.mail-card .from-email { color: var(--text-tertiary); font-size: 12px; margin-bottom: 8px; }
.mail-card .subj-line { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 10px; line-height: 1.35; }
.mail-card .preview { font-size: 13px; color: var(--text-secondary); line-height: 1.45; }
.mail-card .swipe-actions {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--input-border);
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 0 0 20px 20px;
}
.mail-card .swipe-actions button {
  flex: 1;
  min-height: 42px;
  border-radius: 10px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.mail-card .btn-unwichtig { background: rgba(255,59,48,0.15); color: #ff3b30; }
.mail-card .btn-wichtig { background: rgba(52,199,89,0.2); color: #28a745; }
.mail-notes { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--input-border); }
.mail-notes:empty { display: none; }
.mail-notes .notes-title { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-tertiary); margin-bottom: 6px; font-weight: 600; }
.mail-notes .note-item { background: var(--badge-bg); border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; font-size: 13px; color: var(--text-primary); }
.mail-notes .note-meta { display: block; font-size: 11px; color: var(--text-tertiary); margin-top: 3px; }
.mail-stack-empty {
  text-align: center;
  color: #fff;
  padding: 60px 20px;
  font-size: 14px;
  opacity: .8;
}

/* ===== CHAT-AREA ===== */
.chat-area {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
  min-height: 0;
}

.welcome-box {
  align-self: center;
  text-align: center;
  padding: 32px 20px 20px;
  max-width: 380px;
  color: var(--text-secondary);
}
.welcome-icon {
  width: 56px; height: 56px; border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  display: inline-flex; align-items: center; justify-content: center;
  margin: 0 auto 12px; color: #fff;
  box-shadow: 0 8px 32px rgba(4,179,214,0.3);
}
.welcome-title { font-size: 18px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.welcome-text { font-size: 14px; color: var(--text-secondary); line-height: 1.5; }

.msg {
  max-width: 92%;
  padding: 8px 12px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
  animation: msgIn .2s ease;
}
@keyframes msgIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.msg.user {
  align-self: flex-end;
  background: var(--chat-bubble-user);
  color: var(--text-primary);
  border-bottom-right-radius: 6px;
}
.msg.rudi {
  align-self: flex-start;
  background: var(--chat-bubble-rudi);
  color: var(--text-primary);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom-left-radius: 6px;
  position: relative;
}
.speak-btn {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 8px;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--input-border);
  border-radius: 14px;
  color: var(--text-secondary);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
  -webkit-tap-highlight-color: transparent;
}
.speak-btn:hover { background: var(--card-hover-bg); color: var(--text-primary); border-color: var(--accent); }
.speak-btn.loading { opacity: .5; cursor: wait; }
.speak-btn.playing { background: var(--accent); color: #fff; border-color: var(--accent); }
.speak-btn:disabled { cursor: not-allowed; }
.msg.system {
  align-self: center;
  background: transparent;
  color: var(--text-tertiary);
  font-size: 12px;
  font-style: italic;
  padding: 4px 12px;
}
.msg.correction-hint { font-style: normal; display: flex; gap: 10px; align-items: center; background: var(--badge-bg); padding: 6px 12px; border-radius: 10px; }
.msg.correction-hint .link-btn { background: transparent; border: none; color: var(--accent); cursor: pointer; font-size: 12px; padding: 0; text-decoration: underline; }
.msg p { margin: 0 0 6px; }
.msg p:last-child { margin-bottom: 0; }
.msg ul, .msg ol { padding-left: 18px; margin: 3px 0 6px; }
.msg li { margin-bottom: 3px; }
.msg h1, .msg h2, .msg h3, .msg h4 { font-size: 14px; font-weight: 600; margin: 8px 0 4px; line-height: 1.3; }
.msg h1:first-child, .msg h2:first-child, .msg h3:first-child { margin-top: 0; }
.msg strong { font-weight: 600; }
.msg code { background: rgba(0,0,0,0.06); padding: 1px 5px; border-radius: 4px; font-size: 12px; font-family: SF Mono, Menlo, monospace; }
[data-theme="dark"] .msg code { background: rgba(255,255,255,0.08); }
.msg pre { background: rgba(0,0,0,0.06); padding: 10px 12px; border-radius: 10px; margin: 6px 0; overflow-x: auto; font-size: 12px; }
.msg pre code { background: transparent; padding: 0; font-size: 12px; }
.msg a { color: var(--accent); word-break: break-word; }

/* ===== TABELLEN IN CHAT-BUBBLES ===== */
.msg table {
  display: block;
  width: 100%;
  max-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 8px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.35;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.msg table thead tr { background: var(--accent); }
.msg table th {
  padding: 7px 10px;
  text-align: left;
  font-weight: 600;
  color: #fff;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .3px;
  white-space: nowrap;
  border: none;
}
.msg table td {
  padding: 6px 10px;
  color: var(--text-primary);
  border-top: 1px solid var(--card-border);
  vertical-align: top;
}
.msg table tbody tr:nth-child(even) td {
  background: var(--badge-bg);
}
[data-theme="dark"] .msg table tbody tr:nth-child(even) td {
  background: rgba(255,255,255,.03);
}
.msg table tbody tr:hover td {
  background: var(--card-hover-bg);
}
.msg table td:first-child, .msg table th:first-child { padding-left: 12px; }
.msg table td:last-child, .msg table th:last-child { padding-right: 12px; }
/* Rechtsbuendige Zahlen: marked setzt align=right wenn im Markdown " ---: " */
.msg table th[align="right"], .msg table td[align="right"] { text-align: right; font-variant-numeric: tabular-nums; }
.msg table th[align="center"], .msg table td[align="center"] { text-align: center; }
/* Bold-Zellen (z.B. Gesamt-Zeile) */
.msg table td strong, .msg table td b { color: var(--accent); }
/* Erste Spalte dezent haervorheben */
.msg table td:first-child { font-weight: 500; color: var(--text-primary); }
[data-theme="dark"] .msg pre { background: rgba(0,0,0,0.3); }
.msg .status-line { font-size: 12px; opacity: .55; margin-bottom: 5px; }

/* ===== INPUT-BAR ===== */
.input-bar {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 8px 12px;
  /* Safe-Area wird von der Bottom-Nav (darunter) uebernommen */
  background: var(--nav-bg);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border-top: 1px solid var(--nav-border);
}
.input-field {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  max-height: 50dvh;
  padding: 10px 15px;
  border: 1px solid var(--input-border);
  border-radius: 20px;
  background: var(--input-bg);
  color: var(--text-primary);
  font-size: 16px; /* >= 16px verhindert iOS-Auto-Zoom beim Fokus */
  font-family: inherit;
  line-height: 1.38;
  resize: none;
  outline: none;
  transition: border-color .2s, min-height .12s;
  overflow-y: auto;
  -webkit-appearance: none;
  box-sizing: border-box;
  display: block;
}
.input-field:focus { border-color: var(--accent); }
.input-field:disabled { opacity: .5; }
.btn-circle {
  width: 44px; height: 44px; border-radius: 50%;
  border: none; cursor: pointer; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff;
  transition: background .2s, transform .08s;
  -webkit-tap-highlight-color: transparent;
}
.btn-circle:hover { background: var(--accent-hover); }
.btn-circle:active { transform: scale(.92); }
.btn-circle:disabled { opacity: .4; cursor: not-allowed; }
.mic-btn.listening { background: #ff3b30; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }

/* ===== HISTORY-OVERLAY ===== */
.history-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 400;
  display: none;
  flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.history-overlay.show { display: flex; }
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.history-header h3 { font-size: 17px; font-weight: 600; }
.history-search {
  position: relative;
  padding: 10px 14px 6px;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}
.history-search .hs-icon {
  position: absolute;
  left: 26px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.55);
  pointer-events: none;
}
.history-search input {
  width: 100%;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 12px;
  padding: 10px 36px 10px 38px;
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  -webkit-appearance: none;
  outline: none;
  transition: border-color .15s, background .15s;
}
.history-search input::placeholder { color: rgba(255,255,255,0.45); }
.history-search input:focus {
  border-color: var(--accent);
  background: rgba(255,255,255,0.14);
}
.history-search .hs-clear {
  position: absolute;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px; height: 24px;
  border: none; background: rgba(255,255,255,0.15);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px; line-height: 22px; padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.history-search .hs-clear:hover { background: rgba(255,255,255,0.25); }
.history-entry .h-snippet {
  font-size: 12px;
  color: rgba(255,255,255,0.75);
  margin-top: 4px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.history-entry .h-snippet mark {
  background: rgba(4,179,214,0.45);
  color: #fff;
  padding: 0 2px;
  border-radius: 3px;
}
.history-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 14px 30px;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
}
/* Zeitgruppen */
.h-group-label {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-tertiary); padding: 16px 0 6px; margin: 0;
}
.h-group-label:first-child { padding-top: 4px; }

/* Swipe-Wrapper */
.h-swipe-wrapper { overflow: hidden; border-radius: 12px; margin-bottom: 2px; }

.history-entry {
  display: flex; flex-direction: column; justify-content: center;
  padding: 12px 14px; cursor: pointer;
  border-bottom: 1px solid var(--border-color, rgba(0,0,0,0.06));
  transition: background .15s, transform .2s;
  -webkit-tap-highlight-color: transparent;
  background: transparent;
  min-height: 48px;
}
.history-entry:active { background: var(--card-hover-bg, rgba(0,0,0,0.04)); }
.history-entry.active { background: var(--card-hover-bg, rgba(4,179,214,0.08)); }
.history-entry .h-title {
  font-size: 15px; font-weight: 500; color: var(--text-primary);
  line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.history-entry .h-pin { margin-right: 4px; font-size: 12px; }
.history-entry .h-meta {
  font-size: 12px; color: var(--text-tertiary); margin-top: 2px;
}
.history-empty {
  text-align: center; color: var(--text-tertiary); padding: 40px 20px; font-size: 14px;
}

/* Kontextmenu */
.h-ctx-menu {
  position: fixed; z-index: 9999;
  background: var(--card-bg, #fff); border: 1px solid var(--border-color, #ddd);
  border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,0.18);
  min-width: 150px; overflow: hidden;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.h-ctx-item {
  padding: 12px 16px; font-size: 14px; cursor: pointer;
  color: var(--text-primary); border-bottom: 1px solid var(--border-color, rgba(0,0,0,0.06));
}
.h-ctx-item:last-child { border-bottom: none; }
.h-ctx-item:active { background: var(--card-hover-bg, rgba(0,0,0,0.05)); }
.h-ctx-item.danger { color: #ff453a; }

/* ===== INSTALL-HINT ===== */
.install-hint {
  position: fixed;
  bottom: calc(84px + env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  padding: 10px 18px;
  background: rgba(4,179,214,0.96);
  color: #fff;
  border-radius: 24px;
  font-size: 13px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  z-index: 300;
  display: none;
  max-width: 90vw;
  text-align: center;
}
.install-hint.show { display: block; }

/* ===== MOBILE ANPASSUNGEN ===== */
@media (max-width: 600px) {
  .topbar { padding: 8px 14px; min-height: 52px; }
  .topbar-title { font-size: 16px; }
  .topbar-sub { font-size: 11px; }
  .cards-wrap { padding: 8px 0 4px; }
  .cards { padding: 2px 14px 8px; }
  .card { width: 148px; min-height: 76px; padding: 9px 12px; }
  .card-title { font-size: 13px; }
  .chat-area { padding: 6px 12px 8px; gap: 6px; font-size: 13px; }
  .msg { max-width: 94%; font-size: 13px; padding: 7px 11px; }
  .input-bar { padding: 6px 10px; padding-bottom: max(6px, env(safe-area-inset-bottom)); gap: 6px; }
  .input-field { min-height: 42px; padding: 9px 14px; }
  .btn-circle { width: 42px; height: 42px; }
}

/* Landscape iPhone: weniger vertikales Padding */
@media (max-width: 900px) and (orientation: landscape) {
  .topbar { min-height: 48px; padding: 4px 14px; }
  .cards-wrap { padding-top: 6px; }
  .card { min-height: 70px; }
  .welcome-box { padding: 12px 20px; }
}

/* ===== CSP-Helper-Klassen (loesen inline style="..." ab) ===== */
.flex-row-10 { display: flex; align-items: center; gap: 10px; }
.flex-col-6 { display: flex; flex-direction: column; gap: 6px; }
.flex-col-4 { display: flex; flex-direction: column; gap: 4px; }
.flex-row-6 { display: flex; gap: 6px; }
.row-wrap { flex-wrap: wrap; }
.mt-14 { margin-top: 14px; }
.label-tertiary {
  display: block;
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}
.input-narrow { width: 70px; }
.input-min-150 { min-width: 150px; }
.label-flex-1 { flex: 1; }
.textarea-prompt {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
}
.modal-backdrop.hidden { display: none; }
.rm-source.hidden { display: none; }


/* === Auto-Klassen aus inline style="..." in app.js (1 unique) === */
.s-fb754e { opacity:.5; }
