:root {
  --bg: #0a0a0a;
  --bg2: #111111;
  --bg3: #1a1a1a;
  --fg: #e0ddd8;
  --fg2: #706b63;
  --fg3: #3a3732;
  --accent: #c9a84c;
  --danger: #b54a47;
  --done: #5a8a5a;
  --radius: 12px;
  --font: 'Inter', -apple-system, system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', monospace;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---- LOGIN ---- */
#login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 2rem;
}
#login-screen h1 { font-size: 2rem; margin-bottom: 0.5rem; }
#login-screen p { color: var(--fg2); margin-bottom: 2rem; }
#login-screen input {
  background: var(--bg2);
  border: 1px solid transparent;
  color: var(--fg);
  font-family: var(--mono);
  font-size: 1rem;
  padding: 0.8rem 1.2rem;
  border-radius: 8px;
  width: 100%;
  max-width: 300px;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}
#login-screen input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(201,168,76,0.15); }
#login-screen button {
  margin-top: 1rem;
  background: var(--accent);
  color: var(--bg);
  border: none;
  font-weight: 600;
  padding: 0.8rem 2rem;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
}
#login-error { color: var(--danger); margin-top: 1rem; font-size: 0.9rem; }

/* ---- APP SHELL ---- */
#app { display: none; height: 100%; flex-direction: column; }

/* Header */
.header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.header h1 {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--accent);
  flex: 1;
}
.header-ctx {
  display: flex;
  gap: 4px;
}
.ctx-btn {
  background: var(--bg2);
  border: none;
  color: var(--fg2);
  font-size: 0.8125rem;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.2s;
}
.ctx-btn.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

/* Views container */
.views {
  flex: 1;
  overflow: hidden;
  position: relative;
}
.view {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: calc(72px + var(--safe-bottom));
  display: none;
  -webkit-overflow-scrolling: touch;
}
.view.active { display: block; opacity: 1; }

/* Bottom nav */
.bottom-nav {
  display: flex;
  gap: 8px;
  padding: 8px 16px;
  padding-bottom: calc(8px + var(--safe-bottom));
  background: var(--bg);
  flex-shrink: 0;
}
.nav-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 0;
  background: var(--bg2);
  border: none;
  border-radius: 12px;
  color: var(--fg2);
  font-size: 0.9375rem;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s;
}
.nav-btn svg { width: 20px; height: 20px; }
.nav-btn.active { background: var(--accent); color: var(--bg); }
.nav-btn.active svg { stroke: var(--bg); }
.nav-more-btn {
  background: none;
  border: none;
  color: var(--fg3);
  font-size: 0.8125rem;
  font-family: var(--font);
  cursor: pointer;
  padding: 6px 16px;
  width: 100%;
  text-align: center;
  transition: color 0.2s;
}
.nav-more-btn:active { color: var(--fg2); }

/* More drawer */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg);
  border-radius: 16px 16px 0 0;
  z-index: 201;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  padding-bottom: var(--safe-bottom);
  max-height: 60vh;
}
.drawer.open { transform: translateY(0); }
.drawer-handle {
  width: 36px;
  height: 4px;
  background: var(--bg3);
  border-radius: 2px;
  margin: 12px auto;
}
.drawer-items {
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.drawer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--fg);
  font-size: 0.9375rem;
  font-family: var(--font);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 0.15s;
}
.drawer-item:active { background: var(--bg2); }
.drawer-item svg { width: 20px; height: 20px; color: var(--fg2); flex-shrink: 0; }

/* ---- CAPTURE VIEW ---- */
.capture-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
}
.capture-input {
  flex: 1;
  min-height: 120px;
  background: var(--bg2);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 14px;
  color: var(--fg);
  font-family: var(--mono);
  font-size: 0.9375rem;
  line-height: 1.6;
  resize: none;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.capture-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(201,168,76,0.15); }
.capture-input::placeholder { color: var(--fg3); }

.capture-bottom {
  display: flex;
  gap: 10px;
  align-items: center;
}
.capture-bottom .ctx-btn { font-size: 0.8rem; padding: 8px 14px; }

.img-preview {
  display: none;
  position: relative;
  margin-bottom: 4px;
}
.img-preview img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
}
.img-preview .remove-img {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--red);
  color: white;
  border: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn {
  background: var(--bg2);
  border: none;
  color: var(--fg2);
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.icon-btn:active { transform: scale(0.95); }
.icon-btn svg { width: 20px; height: 20px; }

.save-btn {
  flex: 1;
  background: var(--accent);
  color: var(--bg);
  border: none;
  font-weight: 600;
  font-size: 0.9375rem;
  padding: 14px;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.1s;
  height: 48px;
}
.save-btn:active { transform: scale(0.97); opacity: 0.8; }
.save-btn:disabled { opacity: 0.3; }

.save-flash {
  position: fixed;
  top: env(safe-area-inset-top, 12px);
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--bg2);
  color: var(--fg);
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.8125rem;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  margin-top: 12px;
}
.save-flash.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- TIMELINE VIEW ---- */
.entry-card {
  background: var(--bg2);
  border: none;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 8px;
  transition: background 0.2s;
  position: relative;
  overflow: hidden;
}
.entry-card.highlight {
  animation: highlightEntry 1.5s ease forwards;
}
@keyframes highlightEntry {
  0% { box-shadow: 0 0 0 2px rgba(201,168,76,0.3); }
  100% { box-shadow: none; }
}
.entry-meta {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.entry-date {
  font-size: 0.75rem;
  color: var(--fg3);
  font-family: var(--mono);
}
.entry-source {
  font-size: 0.75rem;
  color: var(--fg3);
}
.tag {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  background: var(--bg3);
  color: var(--fg2);
  transition: opacity 0.2s;
}
.tag:active { opacity: 0.7; }
.tag-person, .tag-topic, .tag-context, .tag-type {
  background: var(--bg3);
  color: var(--fg2);
}
.people-grid { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px; }
.person-card { font-size: 0.9rem; padding: 8px 16px; border: none; cursor: pointer; border-radius: 20px; background: var(--bg2); color: var(--fg); }
.entry-text {
  font-size: 0.9375rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.entry-image {
  margin-top: 10px;
  border-radius: 8px;
  max-width: 100%;
  max-height: 300px;
  object-fit: cover;
}
.entry-tasks { margin-top: 10px; }
.entry-task {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  font-size: 0.85rem;
}
.entry-task input[type="checkbox"] {
  accent-color: var(--accent);
  margin-top: 3px;
  width: 16px;
  height: 16px;
}
.entry-task.done { text-decoration: line-through; color: var(--fg2); }

.entry-summary {
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--fg2);
  font-style: italic;
}

.entry-actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}
.entry-delete,
.entry-edit {
  background: none;
  border: none;
  color: var(--fg2);
  cursor: pointer;
  padding: 5px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}
.entry-delete svg,
.entry-edit svg { width: 15px; height: 15px; }
.entry-delete:hover { color: var(--danger); background: var(--bg3); opacity: 1; }
.entry-edit:hover { color: var(--accent); background: var(--bg3); opacity: 1; }

/* Tags collapsible */
.entry-tags-details { display: inline; }
.entry-tags-details summary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--fg3);
  cursor: pointer;
  padding: 3px 8px;
  background: var(--bg3);
  border-radius: 6px;
  list-style: none;
  user-select: none;
}
.entry-tags-details summary::-webkit-details-marker { display: none; }
.entry-tags-details[open] summary { color: var(--accent); }
.entry-tags-body { display: inline-flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.edit-textarea {
  width: 100%;
  min-height: 80px;
  background: var(--bg3);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px;
  color: var(--fg);
  font-family: var(--mono);
  font-size: 0.9375rem;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  margin-top: 8px;
  transition: border-color 0.2s;
}
.edit-textarea:focus { border-color: var(--accent); }

/* ---- TASKS VIEW ---- */
.task-filters {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.task-item {
  background: var(--bg2);
  border: none;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.task-item input[type="checkbox"] {
  accent-color: var(--accent);
  margin-top: 2px;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.task-content { flex: 1; }
.task-text { font-size: 0.9rem; }
.task-details {
  font-size: 0.75rem;
  color: var(--fg2);
  margin-top: 4px;
  display: flex;
  gap: 8px;
}
.task-prio-high { border-left: 3px solid var(--danger); }
.task-prio-medium { border-left: 3px solid var(--accent); }
.task-prio-low { border-left: 3px solid var(--fg3); }
.task-done { opacity: 0.5; }
.task-done .task-text { text-decoration: line-through; }

/* ---- ASK VIEW ---- */
.ask-area { display: flex; flex-direction: column; gap: 12px; height: 100%; }
.ask-history {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  -webkit-overflow-scrolling: touch;
}
.ask-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  color: var(--fg3);
  text-align: center;
  padding: 2rem;
}
.ask-empty-state p { font-size: 0.9375rem; line-height: 1.5; }
.ask-quick-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 0 8px;
}
.ask-quick-btn {
  background: var(--bg2);
  border: none;
  color: var(--fg);
  font-size: 0.8125rem;
  font-family: var(--font);
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  text-align: left;
}
.ask-quick-btn:active { background: var(--bg3); }
.ask-q-bubble {
  align-self: flex-end;
  background: var(--accent);
  color: var(--bg);
  padding: 10px 14px;
  border-radius: 12px 12px 4px 12px;
  font-size: 0.9375rem;
  max-width: 85%;
  word-break: break-word;
}
.ask-a-bubble {
  background: var(--bg2);
  padding: 14px;
  border-radius: 12px;
  font-size: 0.9375rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.ask-bottom {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.ask-bottom .ask-input { flex: 1; min-height: 48px; }
.ask-send-btn {
  background: var(--accent);
  border: none;
  color: var(--bg);
  width: 48px;
  height: 48px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.1s;
}
.ask-send-btn:active { opacity: 0.7; }
.ask-send-btn svg { width: 20px; height: 20px; }
.ask-input {
  background: var(--bg2);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 14px;
  color: var(--fg);
  font-family: var(--font);
  font-size: 0.9375rem;
  resize: none;
  outline: none;
  min-height: 60px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ask-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(201,168,76,0.15); }
.ask-result {
  flex: 1;
  overflow-y: auto;
  font-size: 0.92rem;
  line-height: 1.6;
  white-space: pre-wrap;
}
.ask-loading {
  color: var(--fg2);
  font-style: italic;
}

/* ---- TEMPLATE PILLS ---- */
.template-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 2px 0;
}
.template-pills::-webkit-scrollbar { display: none; }
.template-pill {
  background: var(--bg2);
  border: none;
  color: var(--fg2);
  font-size: 0.8125rem;
  font-family: var(--font);
  padding: 8px 14px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s;
}
.template-pill.active {
  background: var(--accent);
  color: var(--bg);
}
.template-pill.active::after {
  content: ' \00d7';
  font-weight: 600;
}

/* ---- TEMPLATE SELECTOR (legacy - kept for manager) ---- */
.template-bar {
  display: flex;
  gap: 8px;
  align-items: center;
}
.template-bar select {
  flex: 1;
  background: var(--bg2);
  border: none;
  color: var(--fg);
  font-family: var(--font);
  font-size: 0.8125rem;
  padding: 10px 12px;
  border-radius: 8px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23706b63' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.template-bar select:focus { box-shadow: 0 0 0 2px rgba(201,168,76,0.2); }

.template-result {
  background: var(--bg2);
  border: none;
  border-radius: 12px;
  padding: 14px;
  max-height: 300px;
  overflow-y: auto;
}
.template-result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
}
.template-result-text {
  font-size: 0.9rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---- TEMPLATE MODAL ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal {
  background: var(--bg);
  border: none;
  border-radius: 12px;
  width: 100%;
  max-width: 500px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
}
.modal-header h2 { font-size: 1.1rem; }
.modal-close {
  background: none;
  border: none;
  color: var(--fg2);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0 4px;
}
.modal-body {
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-body input,
.modal-body textarea {
  background: var(--bg2);
  border: 1px solid transparent;
  color: var(--fg);
  font-family: var(--font);
  font-size: 0.9375rem;
  padding: 10px 12px;
  border-radius: 8px;
  outline: none;
  width: 100%;
  transition: border-color 0.2s;
}
.modal-body textarea {
  font-family: var(--mono);
  min-height: 100px;
  resize: vertical;
  line-height: 1.5;
}
.modal-body input:focus,
.modal-body textarea:focus { border-color: var(--accent); }
.modal-body h3 {
  font-size: 0.85rem;
  color: var(--fg2);
  margin-top: 4px;
}

.tmpl-list-item {
  background: var(--bg2);
  border: none;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.tmpl-list-info { flex: 1; min-width: 0; }
.tmpl-list-name { font-weight: 600; font-size: 0.9rem; margin-bottom: 4px; }
.tmpl-list-preview { font-size: 0.78rem; color: var(--fg2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tmpl-list-actions { display: flex; gap: 4px; flex-shrink: 0; }
.tmpl-list-actions button {
  background: none;
  border: none;
  color: var(--fg2);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.tmpl-list-actions button:hover { background: var(--bg3); }
.tmpl-list-actions button.tmpl-delete:hover { color: var(--danger); }
.tmpl-list-actions button.tmpl-edit:hover { color: var(--accent); }

.save-btn.template-mode {
  background: var(--accent);
  opacity: 0.9;
}
.save-btn.template-mode:active { opacity: 0.7; }

/* ---- TASK GOTO BUTTON ---- */
.task-goto {
  background: none;
  border: none;
  color: var(--fg2);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity 0.15s, color 0.15s;
}
.task-goto:hover { color: var(--accent); opacity: 1; }
.task-goto svg { width: 15px; height: 15px; }

/* ---- HEADER SEARCH ---- */
.header-search-btn {
  background: none;
  border: none;
  color: var(--fg2);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  transition: color 0.15s, background 0.15s;
}
.header-search-btn:hover { color: var(--accent); background: var(--bg2); }
.header-search-btn svg { width: 20px; height: 20px; }

/* ---- SEARCH OVERLAY ---- */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,10,10,0.95);
  z-index: 300;
  display: flex;
  flex-direction: column;
  padding: 0;
}
.search-overlay-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg);
}
.search-overlay-header svg { width: 18px; height: 18px; color: var(--fg2); flex-shrink: 0; }
.search-overlay-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--fg);
  font-family: var(--font);
  font-size: 1rem;
  outline: none;
}
.search-overlay-input::placeholder { color: var(--fg2); }
.search-close {
  background: none;
  border: none;
  color: var(--fg2);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 2px 6px;
}
.search-results {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  -webkit-overflow-scrolling: touch;
}
.search-result-item {
  padding: 12px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 2px;
}
.search-result-item:hover, .search-result-item:active { background: var(--bg2); }
.search-result-date {
  font-size: 0.72rem;
  color: var(--fg2);
  font-family: var(--mono);
  margin-bottom: 4px;
}
.search-result-text {
  font-size: 0.9rem;
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.search-empty {
  text-align: center;
  padding: 2rem;
  color: var(--fg2);
  font-size: 0.9rem;
}

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--fg2);
}
.empty-state .emoji { font-size: 2.5rem; margin-bottom: 1rem; }
.empty-state p { font-size: 0.9rem; line-height: 1.5; }

/* ---- REDUCED MOTION ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---- VIEW TRANSITIONS ---- */
.view {
  opacity: 0;
  transition: opacity 0.2s ease;
}
.view.active {
  opacity: 1;
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 2px; }

/* ---- REPLY INDICATOR ---- */
.reply-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg2);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  font-size: 0.8125rem;
}
.reply-label {
  color: var(--accent);
  font-weight: 500;
  white-space: nowrap;
}
.reply-text {
  color: var(--fg2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.reply-cancel {
  background: none;
  border: none;
  color: var(--fg2);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 4px;
  flex-shrink: 0;
}

.entry-reply {
  background: none;
  border: none;
  color: var(--fg2);
  cursor: pointer;
  padding: 5px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}
.entry-reply svg { width: 15px; height: 15px; }
.entry-reply:hover { color: var(--accent); background: var(--bg3); opacity: 1; }

/* ---- CONNECTIONS VIEW ---- */
.conn-section {
  margin-bottom: 20px;
}
.conn-section h3 {
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 10px;
  font-weight: 600;
}
.conn-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg2);
  border-radius: 8px;
  margin-bottom: 4px;
  gap: 12px;
}
.conn-label {
  font-size: 0.9rem;
  font-weight: 500;
}
.conn-count {
  font-size: 0.75rem;
  color: var(--fg2);
  white-space: nowrap;
}
.trend-up { color: var(--accent); }
.trend-down { color: var(--danger); }
.trend-same { color: var(--fg2); }

/* ---- BRIEFING CARD ---- */
.briefing-card {
  background: var(--bg2);
  border-radius: 12px;
  padding: 14px;
  border-left: 3px solid var(--accent);
  animation: fadeIn 0.3s ease;
}
.briefing-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}
.briefing-close {
  background: none;
  border: none;
  color: var(--fg2);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 4px;
}
.briefing-body {
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--fg);
}
.briefing-body .briefing-overdue { color: var(--danger); }
.briefing-body .briefing-resurface {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--bg3);
  color: var(--fg2);
  font-style: italic;
}

/* ---- OFFLINE BANNER ---- */
.offline-banner {
  position: fixed;
  top: env(safe-area-inset-top, 0px);
  left: 0;
  right: 0;
  background: var(--accent);
  color: var(--bg);
  text-align: center;
  padding: 6px 16px;
  font-size: 0.8125rem;
  font-weight: 500;
  z-index: 400;
  animation: slideDown 0.3s ease;
}
@keyframes slideDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

/* ---- ANIMATIONS ---- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.entry-card { animation: fadeIn 0.2s ease; }
