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

:root {
  --bg: #0f0f1a;
  --card: #1a1a2e;
  --card2: #16213e;
  --card3: #1e1e35;
  --accent: #7c3aed;
  --accent-light: #a855f7;
  --accent-dim: rgba(124,58,237,0.15);
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --border: #2d2d44;
  --header-h: 56px;
  --nav-h: 60px;
  --radius-bubble: 18px;
  --radius-input: 24px;
}

html { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ── */
#app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: calc(var(--header-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}

#header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text);
}

.brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-light);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--accent); }
  50% { opacity: 0.6; box-shadow: 0 0 3px var(--accent); }
}

#header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

#model-chip {
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: 20px;
  color: var(--accent-light);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 5px 12px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}

#model-chip:active { transform: scale(0.95); background: rgba(124,58,237,0.3); }


#ctx-chip {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 5px 9px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
#ctx-chip:active { opacity: 0.7; }
#ctx-chip.warn { border-color: #eab308; color: #eab308; }
#ctx-chip.danger { border-color: #ef4444; color: #ef4444; }

/* ── Main ── */
#app-main {
  flex: 1;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

.tab-content {
  display: none;
  flex: 1;
  overflow: hidden;
  flex-direction: column;
}

.tab-content.active { display: flex; }

/* ── Chat ── */
#messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.bubble {
  max-width: 82%;
  padding: 10px 14px;
  line-height: 1.55;
  font-size: 0.93rem;
  word-break: break-word;
  position: relative;
}

.bubble-user {
  background: var(--accent);
  color: #fff;
  align-self: flex-end;
  border-radius: var(--radius-bubble) var(--radius-bubble) 4px var(--radius-bubble);
  box-shadow: 0 2px 12px rgba(124,58,237,0.35);
  white-space: pre-wrap;
}

.bubble-assistant {
  background: var(--card2);
  color: var(--text);
  align-self: flex-start;
  border-radius: var(--radius-bubble) var(--radius-bubble) var(--radius-bubble) 4px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 6px rgba(0,0,0,0.3);
}

/* Markdown elements inside assistant bubbles */
.bubble-assistant p { margin: 0 0 0.5em; }
.bubble-assistant p:last-child { margin-bottom: 0; }
.bubble-assistant h3 { font-size: 1rem; font-weight: 700; margin: 0.7em 0 0.3em; color: var(--accent-light); }
.bubble-assistant h4 { font-size: 0.95rem; font-weight: 700; margin: 0.6em 0 0.3em; color: var(--accent-light); }
.bubble-assistant h5 { font-size: 0.9rem; font-weight: 600; margin: 0.5em 0 0.2em; color: var(--text-muted); }
.bubble-assistant strong { font-weight: 700; color: #fff; }
.bubble-assistant em { font-style: italic; color: var(--text-muted); }
.bubble-assistant ul, .bubble-assistant ol { padding-left: 1.3em; margin: 0.4em 0; }
.bubble-assistant li { margin: 0.2em 0; }
.bubble-assistant code {
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: "JetBrains Mono", "Fira Code", "Menlo", monospace;
  font-size: 0.82em;
  color: #c4b5fd;
}
.bubble-assistant pre {
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  margin: 0.5em 0;
}
.bubble-assistant pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.83em;
  color: var(--text);
  white-space: pre;
}
.bubble-assistant hr { border: none; border-top: 1px solid var(--border); margin: 0.6em 0; }
.bubble-assistant a { color: var(--accent-light); text-decoration: underline; }

.model-tag {
  font-size: 0.62rem;
  color: var(--text-muted);
  margin-top: 5px;
  opacity: 0.7;
}

.typing-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  margin: 0 2px;
  animation: typing 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-5px); opacity: 1; }
}

/* ── Input Area ── */
#input-area {
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  flex-shrink: 0;
}

#attachment-preview {
  font-size: 0.75rem;
  color: var(--accent-light);
  margin-bottom: 5px;
  padding-left: 4px;
  min-height: 0;
}

#input-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.icon-btn {
  background: var(--card3);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-muted);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}

.icon-btn:active { background: var(--accent-dim); color: var(--accent-light); }

#msg-input {
  flex: 1;
  background: var(--card3);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  color: var(--text);
  padding: 9px 14px;
  font-size: 0.92rem;
  font-family: inherit;
  resize: none;
  max-height: 110px;
  overflow-y: auto;
  line-height: 1.4;
  transition: border-color 0.15s;
}

#msg-input:focus { outline: none; border-color: var(--accent); }
#msg-input::placeholder { color: var(--text-muted); }

#mic-btn {
  background: var(--card3);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-muted);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}

#mic-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 12px rgba(124,58,237,0.5);
}

#send-btn {
  background: var(--accent);
  border: none;
  border-radius: 50%;
  color: #fff;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.15s, transform 0.1s;
  box-shadow: 0 2px 8px rgba(124,58,237,0.4);
}

#send-btn:disabled { opacity: 0.35; cursor: default; box-shadow: none; }
#send-btn:not(:disabled):active { transform: scale(0.9); }

/* ── Bottom Nav ── */
#bottom-nav {
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  padding: 8px 0 4px;
  position: relative;
  transition: color 0.15s;
  min-height: 48px;
  -webkit-tap-highlight-color: transparent;
}

.nav-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 25%;
  width: 50%;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform 0.2s ease;
}

.nav-btn.active { color: var(--accent-light); }
.nav-btn.active::before { transform: scaleX(1); }

.nav-icon {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  transition: stroke 0.15s;
}

.nav-label {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ── TODOs Layout ── */
#todos {
  overflow: hidden;
}

/* ── TODO Create (bottom bar) ── */
#todo-create {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--card);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

#todo-input {
  flex: 1;
  background: var(--card3);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  color: var(--text);
  padding: 10px 14px;
  font-size: 0.9rem;
  font-family: inherit;
}

#todo-input:focus { outline: none; border-color: var(--accent); }
#todo-input::placeholder { color: var(--text-muted); }

#todo-add-btn {
  background: var(--accent);
  border: none;
  border-radius: 50%;
  color: #fff;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(124,58,237,0.4);
  -webkit-tap-highlight-color: transparent;
}
#todo-add-btn:active { transform: scale(0.92); }

#todo-refresh-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 50%;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s, background 0.15s;
}
#todo-refresh-btn:active { background: var(--accent-dim); color: var(--accent-light); }

/* ── Calendar ── */
#calendar { overflow: hidden; }

/* Top bar */
#cal-topbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#cal-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

#cal-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  text-align: center;
}

.cal-nav-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 5px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s, background 0.15s;
}
.cal-nav-btn:active { background: var(--accent-dim); color: var(--accent-light); }

#cal-view-toggle {
  display: flex;
  background: var(--card3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px;
  flex-shrink: 0;
}

.view-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.view-btn.active {
  background: var(--accent);
  color: #fff;
}

#cal-add-btn {
  background: var(--accent);
  border: none;
  border-radius: 50%;
  color: #fff;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(124,58,237,0.4);
  -webkit-tap-highlight-color: transparent;
}
#cal-add-btn:active { transform: scale(0.9); }

/* Month view */
#cal-month-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

#cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 6px 8px 4px;
  flex-shrink: 0;
}
#cal-weekdays span {
  text-align: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 0 8px;
  flex-shrink: 0;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s;
}
.cal-day:active { background: var(--card3); }
.cal-day.other-month .cal-day-num { color: #3a3a5c; }
.cal-day.today .cal-day-num {
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cal-day.selected { background: var(--accent-dim); }
.cal-day.selected .cal-day-num { color: var(--accent-light); font-weight: 700; }
.cal-day-num {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1;
}
.cal-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-light);
  margin-top: 2px;
}

#cal-events-panel {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px 8px;
  -webkit-overflow-scrolling: touch;
}
#cal-events-list { display: flex; flex-direction: column; gap: 8px; }
.cal-event-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.cal-event-card:active { background: var(--card3); }
.cal-event-time {
  font-size: 0.72rem;
  color: var(--accent-light);
  font-weight: 600;
  flex-shrink: 0;
  min-width: 44px;
  padding-top: 2px;
}
.cal-event-info { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.cal-event-title { font-size: 0.9rem; color: var(--text); }
.cal-event-loc { font-size: 0.72rem; color: var(--text-muted); }

/* Week + Day shared time grid */
#cal-week-view, #cal-day-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

#week-col-header, #week-allday-strip, #day-allday-strip {
  display: flex;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}

#week-col-header {
  background: var(--card);
  padding: 4px 0;
}

.tgutter {
  width: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tlabel {
  font-size: 0.6rem;
  color: var(--text-muted);
  writing-mode: horizontal-tb;
}

.week-col-head {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.week-col-dow {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.week-col-day {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.week-col-head.today .week-col-day {
  background: var(--accent);
  color: #fff;
}
.week-col-head.selected .week-col-day {
  background: var(--accent-dim);
  color: var(--accent-light);
}

#week-allday-strip, #day-allday-strip {
  background: var(--card);
  min-height: 28px;
  padding: 3px 0;
}

.week-allday-col {
  flex: 1;
  padding: 0 1px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.allday-chip {
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: 4px;
  font-size: 0.65rem;
  color: var(--accent-light);
  padding: 1px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#week-scroll, #day-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#week-grid, #day-grid {
  display: flex;
  position: relative;
}

.tgutter.time-col {
  padding-top: 0;
}

#week-time-col, #day-time-col {
  width: 44px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.hour-label {
  height: 56px;
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding-right: 6px;
  padding-top: 2px;
  font-size: 0.6rem;
  color: var(--text-muted);
  box-sizing: border-box;
}

#week-day-cols {
  flex: 1;
  display: flex;
}

.week-day-col {
  flex: 1;
  position: relative;
  border-left: 1px solid var(--border);
}

.day-col {
  flex: 1;
  position: relative;
  border-left: 1px solid var(--border);
}

.hour-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 56px;
  border-top: 1px solid #2a2a40;
  box-sizing: border-box;
}
.hour-line:nth-child(even) { border-top-style: dashed; border-top-color: #22223a; }

.cal-event-block {
  position: absolute;
  left: 2px;
  right: 2px;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-left: 3px solid var(--accent-light);
  border-radius: 5px;
  padding: 2px 4px;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
  z-index: 1;
}
.cal-event-block:active { background: rgba(124,58,237,0.3); }
.ev-block-title {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ev-block-time {
  font-size: 0.6rem;
  color: var(--text-muted);
}

.now-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: #ef4444;
  z-index: 2;
}
.now-dot {
  position: absolute;
  left: -4px;
  top: -4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
}

#day-allday-events {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 3px 4px;
}

/* ── Event Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 100;
  align-items: flex-end;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.modal-overlay.open { display: flex; }

.modal-card {
  background: var(--card);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 480px;
  padding-bottom: env(safe-area-inset-bottom);
  animation: slide-up 0.2s ease;
}

@keyframes slide-up {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 10px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  display: flex;
  -webkit-tap-highlight-color: transparent;
}
.modal-close:active { background: var(--card3); }

.modal-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.modal-input {
  width: 100%;
  background: var(--card3);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  padding: 11px 14px;
  font-size: 0.92rem;
  font-family: inherit;
  -webkit-appearance: none;
}
.modal-input:focus { outline: none; border-color: var(--accent); }
.modal-input::placeholder { color: var(--text-muted); }

.modal-select option { background: var(--card2); }
.modal-select { cursor: pointer; }

.modal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
}
.modal-label {
  font-size: 0.88rem;
  color: var(--text);
}
.modal-time-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.time-input { flex: 1; text-align: center; }
.time-sep { color: var(--text-muted); font-size: 1.1rem; flex-shrink: 0; }

.ev-error {
  font-size: 0.78rem;
  color: #f87171;
  min-height: 0;
}

.modal-footer {
  display: flex;
  gap: 10px;
  padding: 10px 16px 16px;
  border-top: 1px solid var(--border);
}
.modal-btn-cancel {
  flex: 1;
  background: var(--card3);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.modal-btn-save {
  flex: 2;
  background: var(--accent);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 12px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(124,58,237,0.4);
  -webkit-tap-highlight-color: transparent;
}
.modal-btn-save:disabled { opacity: 0.4; cursor: default; }
.modal-btn-cancel:active { background: var(--border); }
.modal-btn-save:not(:disabled):active { transform: scale(0.97); }

/* ── TODOs ── */
#todos { overflow: hidden; }

#todo-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0 4px;
  display: flex;
  flex-direction: column;
  -webkit-overflow-scrolling: touch;
}

.todo-section-header {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 16px 4px;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid rgba(45,45,68,0.5);
  -webkit-tap-highlight-color: transparent;
  transition: background 0.1s;
}
.todo-item:active { background: var(--card3); }

.todo-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: none;
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.todo-circle.checked {
  border-color: var(--accent);
  background: var(--accent);
}
.todo-circle.checked::after {
  content: '';
  display: block;
  width: 5px;
  height: 9px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg) translate(-1px, -1px);
}

.todo-text {
  flex: 1;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--text);
  transition: color 0.2s;
}
.todo-text.done { text-decoration: line-through; color: var(--text-muted); }

.todo-file-hint {
  font-size: 0.62rem;
  color: #3a3a5c;
  flex-shrink: 0;
  max-width: 70px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}

.event-date {
  font-size: 0.72rem;
  color: var(--accent-light);
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-bottom: 3px;
}

.event-title {
  font-size: 0.9rem;
  color: var(--text);
}

/* ── Briefing Tab ── */
#briefing {
  overflow: hidden;
}

#briefing-toolbar {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#briefing-regen-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: 20px;
  color: var(--accent-light);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}
#briefing-regen-btn:active { background: rgba(124,58,237,0.3); }
#briefing-regen-btn:disabled { opacity: 0.4; cursor: default; }

#briefing-frame {
  flex: 1;
  border: none;
  background: #0f0f1a;
}


.loading {
  color: var(--text-muted);
  font-size: 0.88rem;
  text-align: center;
  margin-top: 32px;
}

/* ── Plus-Button ── */
#plus-btn {
  background: var(--card3);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-muted);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

#plus-btn.open {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent-light);
  transform: rotate(45deg);
}

/* ── Attach Menu ── */
#attach-menu {
  display: none;
  flex-direction: column;
  gap: 2px;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 6px;
  margin-bottom: 8px;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.4);
}

#attach-menu.open { display: flex; }

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s;
  user-select: none;
}

.menu-item:active { background: var(--card3); }

.menu-label {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 500;
}

/* ── Toggle Switch ── */
.toggle-track {
  width: 42px;
  height: 24px;
  background: var(--border);
  border-radius: 12px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle-track.on { background: var(--accent); }

.toggle-thumb {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.toggle-track.on .toggle-thumb { transform: translateX(18px); }

/* Websuche aktiv → Menu-Item leicht hervorheben */
#menu-search.active { color: var(--accent-light); }
#menu-search.active svg { stroke: var(--accent-light); }
