/* Isyra Web — Apple-inspired clean UI */

:root {
  --bg: #f2f2f7;
  --panel: #ffffff;
  --border: #e3e3e8;
  --text: #1c1c1e;
  --text-dim: #8e8e93;
  --accent: #007aff;
  --accent-soft: #e5f1ff;
  --bubble-user: #007aff;
  --bubble-isyra: #e9e9eb;
  --green: #34c759;
  --red: #ff3b30;
  --radius: 14px;
  --sidebar-w: 250px;
  /* calendar person colors */
  --c-robert: #007aff;
  --c-barbara: #ff2d55;
  --c-both: #af52de;
  --c-family: #34c759;
}

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

/* App-Shell: das Dokument selbst scrollt nie — nur die Panels innen.
   Sonst scrollt (v. a. auf iOS via Scroll-Chaining/Bounce) die ganze App
   samt Navigation mit. */
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ── Login ─────────────────────────────────────── */

#login-view {
  display: flex; align-items: center; justify-content: center;
  height: 100vh; padding: 16px; overflow-y: auto;
}
.login-card {
  background: var(--panel); border-radius: 22px; padding: 42px 36px;
  width: 100%; max-width: 380px; text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,.08);
}
.login-logo { font-size: 52px; margin-bottom: 8px; }
.login-card h1 { font-size: 30px; font-weight: 700; }
.login-sub { color: var(--text-dim); margin: 6px 0 26px; }
.login-card input {
  width: 100%; padding: 13px 16px; margin-bottom: 12px;
  border: 1px solid var(--border); border-radius: 12px;
  font-size: 16px; background: var(--bg); outline: none;
}
.login-card input:focus { border-color: var(--accent); background: #fff; }
.login-card button {
  width: 100%; padding: 13px; border: none; border-radius: 12px;
  background: var(--accent); color: #fff; font-size: 16px; font-weight: 600;
  cursor: pointer;
}
.login-card button:disabled { opacity: .6; }
.login-error { color: var(--red); margin-top: 12px; font-size: 14px; }

/* ── Layout ────────────────────────────────────── */

#app-view { display: flex; height: 100vh; height: 100dvh; }

#sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--panel); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 14px 10px;
  overflow-y: auto; overscroll-behavior: contain;
}
.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px 14px;
}
.sidebar-title { font-size: 20px; font-weight: 700; }
.conn-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--red); transition: background .3s;
}
.conn-dot.online { background: var(--green); }

.sidebar-section {
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  color: var(--text-dim); padding: 14px 10px 6px; letter-spacing: .4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 10px; cursor: pointer;
  font-size: 15px; color: var(--text); text-decoration: none;
  user-select: none;
}
.nav-item:hover { background: var(--bg); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-icon { width: 22px; text-align: center; }
.nav-badge {
  margin-left: auto; background: var(--green); color: #fff;
  font-size: 11.5px; font-weight: 700; border-radius: 999px;
  min-width: 20px; height: 20px; padding: 0 6px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}

.sidebar-footer {
  margin-top: auto; padding: 12px 10px 4px;
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--border); font-size: 14px; color: var(--text-dim);
}
.sidebar-footer button {
  border: none; background: none; color: var(--accent);
  cursor: pointer; font-size: 14px;
}
.sidebar-footer #user-name { flex: 1; }
.sidebar-footer #push-btn { font-size: 16px; padding: 0 6px; }

#main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

#main-header {
  display: flex; align-items: baseline; gap: 10px;
  padding: 14px 22px; background: rgba(255,255,255,.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
#main-header h2 { font-size: 19px; }
#main-subtitle { font-size: 13px; color: var(--text-dim); }
#menu-btn {
  display: none; border: none; background: none; font-size: 20px;
  cursor: pointer; color: var(--text);
}

.view { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.panel { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 20px 22px; max-width: 860px; width: 100%; margin: 0 auto; }

/* ── Chat ──────────────────────────────────────── */

#messages {
  flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 20px 22px;
  display: flex; flex-direction: column; gap: 10px;
}
.msg-row { display: flex; max-width: 860px; width: 100%; margin: 0 auto; }
.msg-row.mine { justify-content: flex-end; }
.msg {
  max-width: 78%; padding: 10px 14px; border-radius: 18px;
  font-size: 15px; line-height: 1.45; white-space: pre-wrap;
  overflow-wrap: break-word;
}
.msg-row.mine .msg { background: var(--bubble-user); color: #fff; border-bottom-right-radius: 5px; }
.msg-row.theirs .msg { background: var(--bubble-isyra); border-bottom-left-radius: 5px; }
.msg .sender { display: block; font-size: 12px; font-weight: 600; color: var(--accent); margin-bottom: 3px; }
.msg .time { display: block; font-size: 11px; color: rgba(0,0,0,.45); margin-top: 4px; text-align: right; }
.msg-row.mine .msg .time { color: rgba(255,255,255,.7); }
/* delivery/read checkmarks on own messages: gray ✓✓ = zugestellt, blau = gelesen */
.msg .ticks { margin-left: 4px; letter-spacing: -2px; }
.msg .ticks[data-state="sent"] { opacity: .55; }
.msg .ticks[data-state="read"] { color: #56e0ff; }
.msg a { color: inherit; text-decoration: underline; }
.msg-row.theirs .msg a { color: var(--accent); }
.msg code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px; background: rgba(0,0,0,.07); padding: 1px 5px; border-radius: 5px;
}
.msg img.chat-img { max-width: 100%; border-radius: 10px; display: block; margin-top: 6px; }
.msg .doc-chip {
  display: inline-block; background: rgba(0,0,0,.08);
  padding: 6px 10px; border-radius: 9px; font-size: 13px; margin-top: 6px;
}

.day-divider {
  text-align: center; font-size: 12px; color: var(--text-dim);
  margin: 12px auto 2px; max-width: 860px; width: 100%;
}

/* rich cards */
.rich-card {
  margin-top: 10px; background: #fff; border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden; min-width: 240px;
}
.rich-card .card-title {
  font-size: 13px; font-weight: 600; padding: 9px 12px;
  border-bottom: 1px solid var(--border); background: #fafafa;
}
.rich-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-bottom: 1px solid #f0f0f2;
  font-size: 14px; color: var(--text);
}
.rich-item:last-child { border-bottom: none; }
.rich-item a { color: var(--accent); text-decoration: none; }
.rich-item .sub { font-size: 12px; color: var(--text-dim); display: block; }
.rich-item.done .item-title { text-decoration: line-through; color: var(--text-dim); }
.rich-item input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--green); cursor: pointer; }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.read-dot { width: 8px; height: 8px; flex-shrink: 0; }

#status-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 26px; font-size: 13px; color: var(--text-dim);
  max-width: 860px; width: 100%; margin: 0 auto;
}
.spinner {
  width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--border); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#attach-preview {
  display: flex; align-items: center; gap: 10px;
  margin: 0 auto; max-width: 860px; width: 100%;
  padding: 6px 26px; font-size: 13px; color: var(--text-dim);
}
#attach-remove { border: none; background: none; cursor: pointer; color: var(--red); }

#input-bar {
  display: flex; align-items: flex-end; gap: 10px;
  padding: 12px 22px calc(14px + env(safe-area-inset-bottom));
  background: var(--panel); border-top: 1px solid var(--border);
}
#input-bar > * { flex-shrink: 0; }
#msg-input {
  flex: 1; min-width: 0; resize: none; border: 1px solid var(--border);
  border-radius: 18px; padding: 10px 14px; font-size: 15px;
  font-family: inherit; outline: none; max-height: 140px; background: var(--bg);
}
#msg-input:focus { border-color: var(--accent); background: #fff; }
#attach-btn, #send-btn {
  width: 38px; height: 38px; border-radius: 50%; border: none;
  cursor: pointer; font-size: 17px; display: flex; align-items: center; justify-content: center;
}
#attach-btn { background: var(--bg); color: var(--text-dim); }
#send-btn { background: var(--accent); color: #fff; }
#send-btn:disabled { opacity: .5; }

/* ── Lists (tasks, emails, calendar, automations) ─ */

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tab {
  padding: 6px 14px; border-radius: 16px; font-size: 14px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--border); user-select: none;
}
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.add-form { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.add-form input[type=text] {
  flex: 1; min-width: 180px; padding: 10px 14px; font-size: 15px;
  border: 1px solid var(--border); border-radius: 10px; outline: none; background: var(--panel);
}
.add-form input[type=date] {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px;
  font-family: inherit; background: var(--panel); color: var(--text);
}
.add-form input:focus { border-color: var(--accent); }
.add-form button {
  padding: 10px 18px; border: none; border-radius: 10px;
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer;
}
.add-form button:disabled { opacity: .6; }
.hint { font-size: 13px; color: var(--text-dim); margin-bottom: 12px; }

.list { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.list:empty::after, .list .empty {
  display: block; padding: 26px; text-align: center; color: var(--text-dim); font-size: 14px;
}
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid #f0f0f2; font-size: 15px;
}
.row:last-child { border-bottom: none; }
.row .grow { flex: 1; min-width: 0; }
.row .title { display: block; }
.row .sub { display: block; font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.row.done .title { text-decoration: line-through; color: var(--text-dim); }
.row input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--green); cursor: pointer; flex-shrink: 0; }
.row a { color: var(--accent); text-decoration: none; }
.row .badge {
  font-size: 12px; background: var(--accent-soft); color: var(--accent);
  border-radius: 8px; padding: 2px 8px; flex-shrink: 0;
}
.row .icon-btn {
  border: none; background: none; cursor: pointer; font-size: 15px; color: var(--text-dim);
}
.row .icon-btn:hover { color: var(--red); }

.section-head {
  font-size: 13px; font-weight: 600; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: .3px;
  padding: 18px 2px 8px;
}
.section-head:first-child { padding-top: 0; }

/* toggle switch */
.switch { position: relative; width: 44px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; border-radius: 13px;
  background: #d1d1d6; transition: .2s; cursor: pointer;
}
.switch .slider::before {
  content: ""; position: absolute; width: 22px; height: 22px;
  left: 2px; top: 2px; border-radius: 50%; background: #fff;
  transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* summaries — collapsed by default, tap the header to expand */
.summary-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 20px; margin-bottom: 16px;
  font-size: 15px; line-height: 1.55;
}
.summary-head {
  display: flex; align-items: center; gap: 10px;
  font-weight: 600; cursor: pointer; user-select: none;
}
.summary-head .chevron {
  display: inline-block; transition: transform .2s; color: var(--text-dim);
  transform: rotate(90deg);
}
.summary-card.collapsed .summary-head .chevron { transform: rotate(0deg); }
.summary-body { margin-top: 10px; }
.summary-card.collapsed .summary-body { display: none; }
.summary-card h1, .summary-card h2, .summary-card h3 { margin: 10px 0 6px; }
.summary-card h1 { font-size: 18px; } .summary-card h2 { font-size: 16px; } .summary-card h3 { font-size: 15px; }
.summary-card ul { padding-left: 22px; margin: 4px 0; }

/* ── Reply / quote ─────────────────────────────── */

.reply-quote {
  display: block; border-left: 3px solid var(--accent);
  background: rgba(0,0,0,.06); border-radius: 7px;
  padding: 5px 9px; margin-bottom: 5px; font-size: 12.5px; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis;
}
.msg-row.mine .msg .reply-quote { border-left-color: #fff; background: rgba(255,255,255,.22); }
.reply-quote .reply-sender { display: block; font-weight: 700; font-size: 11px; opacity: .85; }

#reply-preview {
  display: flex; align-items: center; gap: 10px;
  margin: 0 auto; max-width: 860px; width: 100%;
  padding: 6px 26px; font-size: 13px;
}
#reply-preview .reply-quote { flex: 1; min-width: 0; margin-bottom: 0; white-space: nowrap; }
#reply-cancel { border: none; background: none; cursor: pointer; color: var(--red); }

/* ── Voice recording ───────────────────────────── */

#mic-btn {
  width: 38px; height: 38px; border-radius: 50%; border: none;
  cursor: pointer; font-size: 17px; display: flex; align-items: center; justify-content: center;
  background: var(--bg); color: var(--text-dim); flex-shrink: 0;
}
#mic-btn.recording { background: var(--red); color: #fff; animation: recpulse 1.2s ease infinite; }
@keyframes recpulse { 50% { box-shadow: 0 0 0 7px rgba(255,59,48,.25); } }

#record-bar {
  display: flex; align-items: center; gap: 10px;
  margin: 0 auto; max-width: 860px; width: 100%;
  padding: 6px 26px; font-size: 13px; color: var(--text);
}
#record-bar .rec-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--red);
  animation: recblink 1s step-start infinite;
}
@keyframes recblink { 50% { opacity: .25; } }
#record-bar .rec-hint { color: var(--text-dim); }
#record-bar.paused .rec-dot { animation: none; background: var(--text-dim); }
#record-pause {
  border: none; background: none; cursor: pointer; font-size: 16px;
  color: var(--accent); margin-left: auto; padding: 0 4px;
}
#record-cancel { border: none; background: none; cursor: pointer; color: var(--red); }

.msg audio.chat-audio { display: block; margin-top: 6px; max-width: 100%; width: 240px; height: 36px; }

/* ── Scroll to bottom ──────────────────────────── */

#view-chat { position: relative; }
#scroll-bottom-btn {
  position: absolute; right: 18px; bottom: 92px; z-index: 5;
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--panel); color: var(--accent); font-size: 19px; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
}

/* ── Calendar sub-views ────────────────────────── */

.cal-toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.cal-toolbar .tabs { margin-bottom: 0; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-nav button {
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  border-radius: 8px; padding: 4px 11px; font-size: 14px; cursor: pointer;
}
.cal-nav button:hover { border-color: var(--accent); color: var(--accent); }
#cal-range { font-size: 13px; color: var(--text-dim); margin-left: 4px; }

.cal-legend { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; font-size: 12.5px; color: var(--text-dim); }
.leg { display: inline-flex; align-items: center; gap: 5px; }
.leg-toggle { cursor: pointer; user-select: none; }
.leg-toggle input { accent-color: var(--accent); }
.leg-dot { width: 11px; height: 11px; border-radius: 4px; display: inline-block; }
.leg-dot.ev-robert { background: var(--c-robert); }
.leg-dot.ev-barbara { background: var(--c-barbara); }
.leg-dot.ev-both { background: var(--c-both); }
.leg-dot.ev-family { background: var(--c-family); }
.leg-dot.unconfirmed { opacity: .3; }

/* person color bar in list rows */
.cal-row .ev-bar { width: 4px; align-self: stretch; border-radius: 3px; flex-shrink: 0; }
.cal-row.ev-robert .ev-bar { background: var(--c-robert); }
.cal-row.ev-barbara .ev-bar { background: var(--c-barbara); }
.cal-row.ev-both .ev-bar { background: var(--c-both); }
.cal-row.ev-family .ev-bar { background: var(--c-family); }
.cal-row.unconfirmed .ev-bar { opacity: .3; }
.cal-row.unconfirmed .title, .cal-row.unconfirmed .title a { color: var(--text-dim); }
.cal-row.unconfirmed .badge { opacity: .55; }

/* week grid */
.week-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px;
}
.week-day {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 6px; min-height: 130px; display: flex; flex-direction: column; gap: 4px;
}
.week-day.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.week-day-head { font-size: 11.5px; font-weight: 600; color: var(--text-dim); text-align: center; padding-bottom: 2px; }
.week-day.today .week-day-head { color: var(--accent); }
.week-chip {
  display: block; border-radius: 6px; padding: 3px 6px;
  font-size: 11px; line-height: 1.3; color: #fff; text-decoration: none;
  overflow-wrap: break-word;
}
.week-chip .chip-time { display: block; font-size: 9.5px; opacity: .85; }
.week-chip.ev-robert { background: var(--c-robert); }
.week-chip.ev-barbara { background: var(--c-barbara); }
.week-chip.ev-both { background: var(--c-both); }
.week-chip.ev-family { background: var(--c-family); }
/* not confirmed yet → light/transparent version of the same color */
.week-chip.unconfirmed.ev-robert { background: rgba(0,122,255,.14); color: var(--c-robert); border: 1px dashed rgba(0,122,255,.55); }
.week-chip.unconfirmed.ev-barbara { background: rgba(255,45,85,.12); color: var(--c-barbara); border: 1px dashed rgba(255,45,85,.5); }
.week-chip.unconfirmed.ev-both { background: rgba(175,82,222,.13); color: var(--c-both); border: 1px dashed rgba(175,82,222,.5); }
.week-chip.unconfirmed.ev-family { background: rgba(52,199,89,.14); color: #1d8f43; border: 1px dashed rgba(52,199,89,.6); }

/* week time grid (Outlook style: day columns × hour rows) */
.tg-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.tg { min-width: 760px; }
.tg-row { display: grid; grid-template-columns: 40px repeat(7, minmax(96px, 1fr)); }
.tg-head-row { position: sticky; top: 0; z-index: 2; background: var(--panel); border-bottom: 1px solid var(--border); }
.tg-day-head {
  font-size: 11.5px; font-weight: 600; color: var(--text-dim); text-align: center;
  padding: 7px 2px; border-left: 1px solid var(--border);
}
.tg-day-head.today { color: var(--accent); }
.tg-allday-row { border-bottom: 1px solid var(--border); }
.tg-allday-cell { border-left: 1px solid var(--border); padding: 2px; display: flex; flex-direction: column; gap: 2px; min-height: 6px; }
.tg-allday-cell .week-chip { font-size: 10px; padding: 2px 5px; }
.tg-gutter { position: relative; }
.tg-hour {
  position: absolute; right: 5px; transform: translateY(-6px);
  font-size: 9.5px; color: var(--text-dim);
}
.tg-day-col {
  position: relative; border-left: 1px solid var(--border);
  background-image: linear-gradient(to bottom, var(--border) 0, var(--border) 1px, transparent 1px);
  background-repeat: repeat-y;
}
.tg-day-col.today { background-color: rgba(0,122,255,.045); }
.tg-event {
  position: absolute; overflow: hidden; border-radius: 5px; padding: 2px 4px;
  font-size: 10px; line-height: 1.25; color: #fff; text-decoration: none;
  box-shadow: 0 0 0 1px var(--panel);
}
.tg-event .tg-ev-time { display: block; font-size: 8.5px; opacity: .85; }
.tg-event.ev-robert { background: var(--c-robert); }
.tg-event.ev-barbara { background: var(--c-barbara); }
.tg-event.ev-both { background: var(--c-both); }
.tg-event.ev-family { background: var(--c-family); }
.tg-event.unconfirmed.ev-robert { background: rgba(0,122,255,.14); color: var(--c-robert); border: 1px dashed rgba(0,122,255,.55); }
.tg-event.unconfirmed.ev-barbara { background: rgba(255,45,85,.12); color: var(--c-barbara); border: 1px dashed rgba(255,45,85,.5); }
.tg-event.unconfirmed.ev-both { background: rgba(175,82,222,.13); color: var(--c-both); border: 1px dashed rgba(175,82,222,.5); }
.tg-event.unconfirmed.ev-family { background: rgba(52,199,89,.14); color: #1d8f43; border: 1px dashed rgba(52,199,89,.6); }
.tg-now {
  position: absolute; left: 0; right: 0; height: 2px; background: #ff3b30; z-index: 1;
}
.tg-now::before {
  content: ""; position: absolute; left: -3px; top: -3px;
  width: 8px; height: 8px; border-radius: 50%; background: #ff3b30;
}

/* year view */
#year-outer { overflow: auto; max-height: calc(100vh - 230px); border-radius: var(--radius); }
#year-grid {
  display: grid; grid-template-columns: repeat(3, minmax(190px, 1fr)); gap: 12px;
  transform-origin: 0 0; width: max-content; min-width: 100%;
}
.year-month { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px 10px; }
.year-month-head { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.year-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.year-wd { font-size: 8.5px; color: var(--text-dim); text-align: center; }
.year-day {
  font-size: 10px; text-align: center; padding: 2.5px 0; border-radius: 4px;
  color: var(--text);
}
.year-day.marked { color: #fff; font-weight: 600; }
.year-day.today { outline: 2px solid var(--accent); outline-offset: -1px; }

/* Kalender-Aufgaben */
.task-cal-row.done .title { text-decoration: line-through; color: var(--text-dim); }

/* ── Mobile ────────────────────────────────────── */

#sidebar-overlay {
  position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,.35);
}

@media (max-width: 760px) {
  #sidebar {
    position: fixed; z-index: 30; height: 100%;
    transform: translateX(-100%); transition: transform .25s ease;
    box-shadow: 0 0 40px rgba(0,0,0,.2);
  }
  #sidebar.open { transform: translateX(0); }
  #menu-btn { display: block; }
  .msg { max-width: 88%; }
  .panel, #messages { padding: 14px; }
  #input-bar { padding-left: 12px; padding-right: 12px; }
  .week-grid { grid-template-columns: 1fr; }
  .week-day { min-height: 0; }
  #year-grid { grid-template-columns: repeat(2, minmax(170px, 1fr)); }
  #scroll-bottom-btn { bottom: 84px; right: 12px; }
}

/* ── Features (Ideen-Pipeline + Release Notes) ─────────────────────── */
.idea-add-form { margin-bottom: 12px; display: flex; flex-direction: column; gap: 8px; }
.idea-add-form input[type=text], .idea-add-form textarea {
  width: 100%; padding: 10px 14px; font-size: 15px; font-family: inherit;
  border: 1px solid var(--border); border-radius: 10px; outline: none;
  background: var(--panel); resize: vertical;
}
.idea-add-form input:focus, .idea-add-form textarea:focus { border-color: var(--accent); }
.idea-add-row { display: flex; gap: 8px; flex-wrap: wrap; }
.idea-add-row .idea-tags-input { flex: 1; min-width: 140px; max-width: none; }
.idea-add-row button {
  padding: 10px 18px; border: none; border-radius: 10px;
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer;
}
.idea-add-row button:disabled { opacity: .6; }
.add-form select, .idea-select {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--panel); color: var(--text); font-size: 14px; cursor: pointer;
}
.idea-select { flex-shrink: 0; font-size: 13px; padding: 5px 6px; }
.idea-select.prio-high { color: var(--red, #ff3b30); border-color: rgba(255,59,48,.45); font-weight: 600; }
.idea-select.prio-low { color: var(--text-dim); }

/* idea cards: full-width title/notes on top, controls in a footer row —
   replaces the old 3-column .row that squeezed the text on phones */
.idea-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 13px 16px; margin-bottom: 10px;
}
.idea-card.rejected { opacity: .55; }
.idea-card.rejected .idea-title { text-decoration: line-through; }
.idea-head { display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; }
.idea-title { font-weight: 600; font-size: 15px; line-height: 1.4; margin-right: 4px; }
.idea-notes {
  margin-top: 6px; font-size: 13.5px; line-height: 1.5; color: var(--text-dim);
  white-space: pre-wrap; overflow-wrap: break-word;
}
.idea-images { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.idea-thumb-wrap { position: relative; }
.idea-thumb {
  width: 88px; height: 88px; object-fit: cover; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg); cursor: pointer; display: block;
}
.idea-thumb-del {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px;
  border-radius: 50%; border: none; background: var(--red); color: #fff;
  font-size: 12px; cursor: pointer; line-height: 1;
}
.idea-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.idea-meta { font-size: 12px; color: var(--text-dim); }
.idea-actions { margin-left: auto; display: flex; gap: 2px; }
.idea-actions .icon-btn {
  border: none; background: none; cursor: pointer; font-size: 16px;
  color: var(--text-dim); padding: 4px 7px;
}
.idea-actions .icon-btn:hover { color: var(--red); }
.idea-card.editing input, .idea-card.editing textarea {
  width: 100%; padding: 9px 12px; margin-bottom: 8px; font-size: 14px;
  font-family: inherit; border: 1px solid var(--border); border-radius: 10px;
  outline: none; background: var(--bg); resize: vertical;
}
.idea-card.editing input:focus, .idea-card.editing textarea:focus {
  border-color: var(--accent); background: #fff;
}
.idea-save-btn, .idea-cancel-btn {
  padding: 9px 16px; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.idea-save-btn { border: none; background: var(--accent); color: #fff; }
.idea-save-btn:disabled { opacity: .6; }
.idea-cancel-btn { border: 1px solid var(--border); background: var(--panel); color: var(--text); }

/* lightbox for idea images */
.lightbox {
  position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.82);
  display: flex; align-items: center; justify-content: center; cursor: zoom-out;
  padding: 18px;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; }

.tag-chip {
  display: inline-block; font-size: 11px; padding: 1px 8px; margin-left: 4px;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent);
  vertical-align: 1px; white-space: nowrap;
}
.tag-chip.tag-security { background: rgba(255,59,48,.12); color: #d70015; }

/* Ideen sortieren & filtern */
.ideas-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.ideas-toolbar select {
  border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px;
  background: var(--panel); color: var(--text); font-size: 12.5px;
}
.ideas-tagbar { display: flex; gap: 6px; flex-wrap: wrap; }
.tag-chip.tag-filter {
  border: 1px solid transparent; cursor: pointer; margin-left: 0;
  font: inherit; font-size: 11px;
}
.tag-chip.tag-filter.active { border-color: var(--accent); font-weight: 600; }
.tag-chip.tag-filter.tag-security.active { border-color: #d70015; }
.idea-by { font-size: 11.5px !important; opacity: .8; }
.release {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 18px; margin-bottom: 14px;
}
.release-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.release-version {
  font-weight: 700; font-size: 15px; color: var(--accent);
  background: var(--accent-soft); border-radius: 8px; padding: 2px 9px;
}
.release-title { font-weight: 600; }
.release-date { font-size: 12.5px; color: var(--text-dim); margin-left: auto; }
.release-items { margin: 10px 0 2px; padding-left: 20px; }
.release-items li { margin-bottom: 4px; line-height: 1.45; }

/* ── Automation edit mode (row → textarea, like idea cards) ────────── */
.row.editing { display: block; }
.automation-edit { width: 100%; }
.automation-edit textarea {
  width: 100%; padding: 9px 12px; font-size: 14px; font-family: inherit;
  border: 1px solid var(--border); border-radius: 10px; outline: none;
  background: var(--bg); resize: vertical;
}
.automation-edit textarea:focus { border-color: var(--accent); background: #fff; }
.automation-edit .hint { margin: 6px 0 0; }
.automation-edit-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.automation-edit-actions button {
  padding: 9px 16px; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer;
  border: none; background: var(--accent); color: #fff;
}
.automation-edit-actions button:disabled { opacity: .6; }
.automation-edit-actions .cancel { border: 1px solid var(--border); background: var(--panel); color: var(--text); }

/* countdowns */
.cd-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-bottom: 1px solid #f0f0f2; font-size: 15px;
}
.cd-card:last-child { border-bottom: none; }
.cd-card .grow { flex: 1; min-width: 0; }
.cd-card .title { display: block; font-weight: 600; }
.cd-card .sub { display: block; font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.cd-num {
  min-width: 78px; flex-shrink: 0; text-align: center;
  background: var(--accent-soft); border-radius: 12px; padding: 8px 10px;
}
.cd-count { display: block; font-size: 26px; font-weight: 700; color: var(--accent); line-height: 1.1; }
.cd-unit { display: block; font-size: 11px; font-weight: 600; color: var(--accent); opacity: .75; }
.cd-card.expired .cd-num { background: #eafaf0; }
.cd-card.expired .title { color: var(--text-dim); }
.cd-card .icon-btn {
  border: none; background: none; cursor: pointer; font-size: 15px; color: var(--text-dim);
}
.cd-card .icon-btn:hover { color: var(--red); }

/* ── Betreuungslücken (Jahresansicht) — gelb, Rot gehört Barbara ──── */
.year-day.gap { box-shadow: inset 0 0 0 2px #ffd400; border-radius: 4px; }
/* Tag antippen → Details-Panel (Jahresansicht + Home) */
.year-day { cursor: pointer; }
.year-day.selected { outline: 2px solid var(--text); outline-offset: -1px; }
#year-detail, #home-day-detail {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px;
}
#home-day-detail { margin: 12px 0 0; }
.day-detail-head {
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 600; font-size: 14px; margin-bottom: 8px;
}
.day-detail-head .icon-btn {
  border: none; background: none; cursor: pointer; font-size: 14px; color: var(--text-dim);
}
.day-detail-head .icon-btn:hover { color: var(--red); }
.day-detail-gap {
  background: #fff8e1; color: #7a5c00; border-radius: 8px;
  padding: 6px 10px; font-size: 12.5px; margin-bottom: 8px;
}

/* ── Home (Landing-Dashboard) ─────────────────────────────────────── */
/* Zwei feste Spalten: links Monat + News direkt untereinander, rechts die
   Aufgaben — ein auto-fit-Grid würde die News-Karte erst unterhalb der
   höchsten Karte der ersten Zeile beginnen lassen (Lücke unter dem Monat). */
.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.home-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@media (max-width: 700px) {
  .home-grid { grid-template-columns: 1fr; }
}
.home-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
}
.home-card-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  font-weight: 600; font-size: 15px; margin-bottom: 10px;
}
.home-link {
  border: none; background: none; color: var(--accent); cursor: pointer;
  font-size: 13px; padding: 0; flex-shrink: 0;
}
.home-news-date { font-size: 12px; color: var(--text-dim); font-weight: 400; }
#home-month-legend { margin: 0 0 10px; font-size: 11.5px; gap: 8px 10px; }
#home-month .year-month { border: none; background: none; padding: 0; }
#home-month .year-month-head { display: none; }  /* Monat steht im Kartenkopf */
#home-month .year-day { font-size: 12px; padding: 5px 0; }
#home-month .year-wd { font-size: 10px; }
#home-tasks .sub.overdue { color: var(--red); }
.home-news-title { font-size: 14px; margin: 0 0 8px; }
#home-news { font-size: 13.5px; line-height: 1.5; }
#home-news p { margin: 6px 0; }
#home-news ul { margin: 6px 0 6px 18px; }
#year-gaps {
  margin-bottom: 12px; padding: 10px 14px; border-radius: 10px;
  background: #fff8e1; color: #7a5c00; font-size: 13.5px; line-height: 1.5;
}
#year-gaps.ok { background: #eafaf0; color: #1d6b3a; }

/* ── Suche (Verlauf-Bereich) ──────────────────────────────────────── */
.add-form input[type=search] {
  flex: 1; min-width: 180px; padding: 10px 14px; font-size: 15px;
  border: 1px solid var(--border); border-radius: 10px; outline: none; background: var(--panel);
}
.search-hit .search-snippet { display: block; font-size: 14px; margin-top: 2px; }
.search-hit mark {
  background: #ffe9a8; color: inherit; border-radius: 3px; padding: 0 1px;
}

/* ── Architektur-Schaubild (Features-Tab) ─────────────────────────── */
.arch-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 8px;
}
.arch-info { font-size: 13.5px; font-weight: 600; color: var(--text-dim); }
.arch-zoom { display: flex; gap: 6px; flex-shrink: 0; }
.arch-zoom button {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel); font-size: 16px; cursor: pointer; color: var(--text);
}
.arch-zoom button:hover { border-color: var(--accent); color: var(--accent); }
.arch-canvas {
  height: min(62vh, 620px); border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); overflow: hidden; touch-action: none; cursor: grab;
  user-select: none; -webkit-user-select: none;
}
.arch-canvas:active { cursor: grabbing; }
.arch-svg { width: 100%; height: 100%; display: block; }

.arch-band { fill: var(--panel); stroke: var(--border); }
.arch-band-client { fill: #eef6ff; }
.arch-band-nginx  { fill: #f4f0fa; }
.arch-band-api    { fill: #ffffff; }
.arch-band-agent  { fill: #fff7ec; }
.arch-band-ext    { fill: #eefaf1; }
.arch-band-label { font-size: 13px; font-weight: 700; fill: var(--text); }

.arch-node-box { fill: #ffffff; stroke: var(--border); stroke-width: 1.2; }
.arch-node-new .arch-node-box { stroke: var(--green); stroke-width: 2; }
.arch-node-changed .arch-node-box { stroke: #ff9500; stroke-width: 2; }
.arch-node-title { font-size: 12px; font-weight: 700; fill: var(--text); }
.arch-node-desc { font-size: 10.5px; fill: var(--text-dim); }
.arch-node-mod { font-size: 10.5px; fill: #6b7fb0; }
.arch-node-mod-now { fill: #c56a00; font-weight: 700; }
.arch-badge-box { fill: var(--green); }
.arch-node-changed .arch-badge-box { fill: #ff9500; }
.arch-badge { font-size: 9px; font-weight: 700; fill: #fff; letter-spacing: .4px; }

.arch-edge { fill: none; stroke: #b9bcc6; stroke-width: 1.3; }
.arch-edge-new { stroke: var(--green); stroke-width: 2; }
.arch-arrow { fill: #b9bcc6; }
.arch-edge-label {
  font-size: 9.5px; fill: var(--text-dim);
  paint-order: stroke; stroke: var(--bg); stroke-width: 3px;
}

.arch-timeline {
  display: flex; gap: 6px; overflow-x: auto; margin-top: 10px; padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}
.arch-chip {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 6px 10px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel); cursor: pointer; flex-shrink: 0; color: var(--text);
}
.arch-chip:hover { border-color: var(--accent); }
.arch-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.arch-chip-v { font-size: 13px; font-weight: 700; }
.arch-chip-d { font-size: 10px; opacity: .75; }
