/* ===== NOTEXEC — Material Design 3 mobile-first ===== */
:root {
  --md-primary: #000000;
  --md-on-primary: #FFFFFF;
  --md-primary-container: #E0E0E0;
  --md-on-primary-container: #0A0A0A;
  --md-surface: #FAFAFE;
  --md-surface-container: #EEF0FC;
  --md-surface-container-high: #E4E6F6;
  --md-on-surface: #1D1B20;
  --md-on-surface-variant: #49454F;
  --md-outline: #79747E;
  --md-error: #B3261E;
  --radius-card: 16px;
  --radius-full: 999px;
  --shadow-1: 0 1px 2px rgba(0,0,0,.3), 0 1px 3px 1px rgba(0,0,0,.15);
  --shadow-3: 0 4px 8px 3px rgba(0,0,0,.15), 0 1px 3px rgba(0,0,0,.3);
  --font: "Roboto", "Segoe UI", system-ui, -apple-system, sans-serif;
  --snackbar-bg: #322F35;
  --snackbar-text: #FFFFFF;
  --checklist-border: #ECE6F0;
}

/* Dark theme */
[data-theme="dark"] {
  --md-primary: #E0E0E0;
  --md-on-primary: #000000;
  --md-primary-container: #2A2A2A;
  --md-on-primary-container: #E0E0E0;
  --md-surface: #0F0F1A;
  --md-surface-container: #1A1A28;
  --md-surface-container-high: #232336;
  --md-on-surface: #E6E1E5;
  --md-on-surface-variant: #CAC4D0;
  --md-outline: #938F99;
  --md-error: #F2B8B5;
  --snackbar-bg: #E6E1E5;
  --snackbar-text: #0F0F1A;
  --checklist-border: #2B2930;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  font-family: var(--font);
  background: #1a1a1e;
  color: var(--md-on-surface);
  overflow: hidden;
  overscroll-behavior: none;
}

/* ===== Phone frame (mimics a mobile phone on desktop) ===== */
.phone-frame {
  position: relative;
  width: 100%;
  height: 100%;
  margin: 0 auto;
  background: var(--md-surface);
  overflow: hidden;
  max-height: 100%;
}
.phone-notch { display: none; }

@media (min-width: 600px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
  }
  .phone-frame {
    width: 400px;
    height: min(840px, calc(100dvh - 48px));
    border-radius: 36px;
    border: 10px solid #0b0b0d;
    box-shadow: 0 24px 64px rgba(0,0,0,.6);
  }
  .phone-notch {
    display: block;
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 110px;
    height: 24px;
    background: #0b0b0d;
    border-radius: 0 0 16px 16px;
    z-index: 50;
  }
}

.app { position: relative; height: 100%; overflow: hidden; }

/* Edge-swipe back indicator */
.edge-swipe-indicator {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--md-primary);
  color: var(--md-on-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  z-index: 60;
  transition: opacity 0.12s ease, transform 0.1s ease;
}
.edge-swipe-indicator .material-icons-round { font-size: 20px; }
.edge-swiping .edge-swipe-indicator {
  opacity: 0.9;
  transform: translateY(-50%) translateX(var(--edge-swipe-offset, 0px));
}

/* ===== Views ===== */
.view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: translateX(24px);
  transition: opacity .22s ease, transform .22s ease;
  background: var(--md-surface);
}
.view.active { opacity: 1; pointer-events: auto; transform: translateX(0); }

/* ===== App bar ===== */
.appbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 8px 10px 20px;
  background: var(--md-surface);
}
.appbar-title {
  font-family: \"Space Grotesk\", \"Inter\", system-ui, sans-serif;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--md-on-surface);
}
.appbar-title img { height: 28px; width: auto; vertical-align: middle; }
[data-theme=\"dark\"] .appbar-title img { filter: brightness(0) invert(1); }
.appbar-editor { padding-left: 8px; overflow: hidden; }
.appbar-actions { display: flex; gap: 4px; }
.editor-actions {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  /* Hide scrollbar */
  scrollbar-width: none;
  -ms-overflow-style: none;
  mask-image: linear-gradient(to left, transparent, #000 16px, #000 calc(100% - 16px), transparent);
  -webkit-mask-image: linear-gradient(to left, transparent, #000 16px, #000 calc(100% - 16px), transparent);
}
.editor-actions::-webkit-scrollbar { display: none; }
.editor-actions .icon-btn { flex-shrink: 0; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--md-on-surface-variant);
  cursor: pointer;
  transition: background .15s;
}
.icon-btn .material-icons-round { font-size: 20px; }
.icon-btn:active { background: rgba(0,0,0,.12); }
.icon-btn.active { color: var(--md-primary); }

/* Pin button states: unpinned = tilted + dimmed, pinned = upright + filled */
.pin-btn .material-icons-round {
  transform: rotate(45deg);
  opacity: .55;
  transition: transform .2s ease, opacity .2s ease, background .2s ease;
}
.pin-btn.active { color: var(--md-primary); background: var(--md-primary-container); }
.pin-btn.active .material-icons-round {
  transform: rotate(0deg);
  opacity: 1;
}

/* Lock button states */
.lock-btn.locked { color: var(--md-error); }

/* Lock overlay */
.lock-overlay {
  position: absolute;
  inset: 0;
  background: var(--md-surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 30;
}
.lock-overlay .material-icons-round { font-size: 56px; color: var(--md-on-surface-variant); }
.lock-overlay p { color: var(--md-on-surface-variant); font-size: 16px; }
.lock-overlay .btn-filled { padding: 10px 24px; border-radius: var(--radius-full); font-size: 14px; }

/* ===== Search ===== */
.search-wrap { padding: 4px 16px 10px; }
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--md-surface-container-high);
  border-radius: var(--radius-full);
  padding: 4px 8px 4px 16px;
  color: var(--md-on-surface-variant);
}
.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 15px;
  color: var(--md-on-surface);
  padding: 8px 0;
  min-width: 0;
}
.search-bar input::-webkit-search-cancel-button { display: none; }

/* ===== Notes list ===== */
.notes-list {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 16px 120px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.note-card {
  background: var(--md-surface-container);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  cursor: pointer;
  position: relative;
  transition: background .15s, transform .1s;
  user-select: none;
}
.note-card:active { transform: scale(.985); background: var(--md-surface-container-high); }
.note-card.pinned { outline: 1.5px solid var(--md-primary); }
.note-card.swiping { transition: transform .1s ease; }
.note-card.swipe-left { transform: translateX(-88px); background: var(--md-error); opacity: .7; }
.note-card.swipe-right { transform: translateX(88px); background: var(--md-primary-container); opacity: .85; }
.note-card.swipe-archived { opacity: 0; transform: translateX(-120px); transition: opacity .25s, transform .25s; max-height: 0; margin: 0; padding: 0 16px; overflow: hidden; }

.note-card-title {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.note-card-title .pin-icon { font-size: 16px; color: var(--md-primary); }
.note-card-preview {
  font-size: 13px;
  line-height: 1.4;
  color: var(--md-on-surface-variant);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
}
.note-card-dates {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.note-card-date {
  font-size: 11px;
  color: var(--md-outline);
  margin-top: 6px;
}
.note-card-dates .note-card-date { margin-top: 0; }
.note-card-date-sep { font-size: 11px; color: var(--md-outline); opacity: .5; }
/* Due date badge — sits above title on its own line */
.due-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-bottom: 4px;
  width: fit-content;
}
.due-badge.overdue { background: var(--md-error); color: #fff; }
.due-badge.today { background: #FF6D00; color: #fff; }
.due-badge.upcoming { background: var(--md-primary-container); color: var(--md-on-primary-container); }
.due-badge .material-icons-round { font-size: 14px; }
.remind-badge { background: #FF6D00; color: #fff; padding: 2px 4px; }
.remind-badge .material-icons-round { font-size: 14px; }
/* ===== Due date row ===== */
.due-date-row {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px 0;
  margin-top: 2px;
  border-top: 1px solid var(--checklist-border);
  padding-top: 4px;
}
.due-date-text { font-size: 13px; color: var(--md-on-surface-variant); cursor: pointer; flex: 1; }
.due-date-text.active { color: var(--md-primary); font-weight: 500; }

/* ===== Inline reminder row ===== */
.due-remind-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0 4px 28px;
  font-size: 12px;
}
.due-remind-label { color: var(--md-on-surface-variant); white-space: nowrap; font-size: 12px; }
.due-remind-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.remind-chip {
  border: 1px solid var(--md-outline-variant);
  border-radius: 14px;
  padding: 4px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--md-on-surface);
  background: var(--md-surface);
  cursor: pointer;
  transition: background .12s, border-color .12s;
  white-space: nowrap;
}
.remind-chip:active { background: var(--md-surface-container-highest); }
.remind-chip.selected {
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
  border-color: var(--md-primary);
}

/* Alarm button active state */
#btn-remind-toggle.active { color: #FF6D00; }

/* Archive card actions */
.archive-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--md-surface-container-high);
}
.archive-card-actions button {
  font-size: 12px;
  font-weight: 500;
  border: none;
  background: transparent;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
}
.archive-card-actions .btn-restore { color: var(--md-primary); }
.archive-card-actions .btn-permadelete { color: var(--md-error); }
.archive-card-actions button:active { background: var(--md-surface-container-high); }
.archive-count { font-size: 13px; opacity: .7; margin-left: auto; }

.note-card.archived-card { opacity: .6; }
.note-card.archived-card .note-card-title { text-decoration: line-through; }

/* ===== Empty state ===== */
.empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--md-on-surface-variant);
  text-align: center;
  pointer-events: none;
}
.empty-icon { font-size: 64px; opacity: .4; }

/* ===== FAB ===== */
.fab {
  position: absolute;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 18px;
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
  box-shadow: var(--shadow-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .12s, box-shadow .12s;
  z-index: 10;
}
.fab:active { transform: scale(.92); }
.fab .material-icons-round { font-size: 26px; }

.fab-mic {
  background: var(--md-primary);
  color: var(--md-on-primary);
  z-index: 45;
}
.fab-mic.recording {
  background: var(--md-error);
  color: #fff;
  animation: mic-pulse 1.4s infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: var(--shadow-3); }
  50% { box-shadow: 0 0 0 12px rgba(179,38,30,.18); }
}

/* ===== Editor ===== */
.editor-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 2px 20px 36px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.note-title-input {
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 20px;
  font-weight: 500;
  color: var(--md-on-surface);
  padding: 6px 0 2px;
}
.note-body-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 15px;
  line-height: 1.5;
  color: var(--md-on-surface);
  resize: none;
  padding: 4px 0;
  min-height: 150px;
}
.editor-status {
  position: absolute;
  left: 16px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
  font-size: 11px;
  color: var(--md-outline);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color .3s ease;
}
/* Saving dot animation */
.editor-status.saving {
  color: var(--md-primary);
}
.editor-status.saving::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--md-primary);
  animation: save-dot-pulse .8s infinite;
}
@keyframes save-dot-pulse {
  0%, 100% { opacity: .3; transform: scale(.8); }
  50% { opacity: 1; transform: scale(1.2); }
}
.editor-status.saved {
  color: #2E7D32;
}
[data-theme="dark"] .editor-status.saved {
  color: #66BB6A;
}
.editor-status.just-saved {
  color: #2E7D32;
  font-weight: 500;
  animation: saved-flash .3s ease;
}
[data-theme="dark"] .editor-status.just-saved {
  color: #66BB6A;
}
@keyframes saved-flash {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
.editor-status.error {
  color: var(--md-error);
  font-weight: 500;
}

/* Word/character count */
.word-count {
  position: absolute;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
  font-size: 10px;
  color: var(--md-outline);
  opacity: 0;
  transition: opacity .25s ease;
  pointer-events: none;
}
.word-count.visible {
  opacity: .7;
}

/* ===== Listening / dictation overlay ===== */
.listening-overlay {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 88px);
  z-index: 40;
  animation: overlay-in .22s ease;
}
@keyframes overlay-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.dictation-card {
  background: rgba(29,27,32,.95);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
  border-radius: 24px;
  padding: 18px 16px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,.45);
}

.dictation-mic {
  position: relative;
  width: 72px;
  height: 72px;
  border: none;
  border-radius: 50%;
  background: #D32F2F;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  animation: mic-breathe 1.6s ease-in-out infinite;
  -webkit-tap-highlight-color: transparent;
}
.dictation-mic::before,
.dictation-mic::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(211,47,47,.55);
  animation: ring-pulse 1.8s ease-out infinite;
}
.dictation-mic::after { animation-delay: .9s; }
.dictation-mic .material-icons-round { font-size: 32px; }

@keyframes ring-pulse {
  0% { transform: scale(1); opacity: .8; }
  100% { transform: scale(1.7); opacity: 0; }
}
@keyframes mic-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.dictation-text { display: flex; align-items: baseline; gap: 10px; }
.dictation-label { font-size: 16px; font-weight: 600; }
.dictation-timer {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: rgba(255,255,255,.75);
}

.eq-bars { display: flex; align-items: center; gap: 4px; height: 28px; }
.eq-bar {
  width: 4px;
  height: 8px;
  border-radius: 2px;
  background: #E53935;
  animation: eq-bounce 1s ease-in-out infinite;
}
.eq-bar:nth-child(1) { animation-delay: 0s; }
.eq-bar:nth-child(2) { animation-delay: .15s; }
.eq-bar:nth-child(3) { animation-delay: .3s; }
.eq-bar:nth-child(4) { animation-delay: .45s; }
.eq-bar:nth-child(5) { animation-delay: .6s; }
@keyframes eq-bounce {
  0%, 100% { height: 8px; }
  50% { height: 26px; }
}

.dictation-hint {
  font-size: 12px;
  color: rgba(255,255,255,.6);
  text-align: center;
}

.dictation-stop-btn {
  width: 100%;
  max-width: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  border: none;
  border-radius: 999px;
  background: #fff;
  color: #B3261E;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.dictation-stop-btn:active { transform: scale(.97); background: #f0f0f0; }

/* Processing / done states: pause recording animations */
.listening-overlay.processing .dictation-mic,
.listening-overlay.done .dictation-mic { animation: none; }
.listening-overlay.processing .dictation-mic { background: #4a4458; }
.listening-overlay.done .dictation-mic { background: #2E7D32; }
.listening-overlay.processing .dictation-mic::before,
.listening-overlay.processing .dictation-mic::after,
.listening-overlay.done .dictation-mic::before,
.listening-overlay.done .dictation-mic::after { display: none; }
.listening-overlay.processing .dictation-mic .material-icons-round {
  animation: spin 1.2s linear infinite;
}
.listening-overlay.processing .eq-bars,
.listening-overlay.done .eq-bars { opacity: .35; }
.listening-overlay.processing .eq-bar,
.listening-overlay.done .eq-bar { animation: none; height: 6px; }
.listening-overlay.processing .dictation-stop-btn,
.listening-overlay.processing .dictation-hint,
.listening-overlay.processing .dictation-timer,
.listening-overlay.done .dictation-stop-btn,
.listening-overlay.done .dictation-hint,
.listening-overlay.done .dictation-timer { display: none; }

@media (max-width: 599px) {
  .listening-overlay {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 76px);
  }
}

/* ===== Snackbar ===== */
.snackbar {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 80px);
  background: var(--snackbar-bg);
  color: var(--snackbar-text);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  z-index: 60;
}
.snackbar.show { opacity: 1; transform: translateY(0); }

/* ===== PWA install & update banners ===== */
.install-banner,
.update-banner {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 72px);
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 55;
  box-shadow: var(--shadow-3);
  transform: translateY(0);
  transition: opacity .25s, transform .25s;
}
.install-banner.hidden,
.update-banner.hidden {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}
.install-banner-text,
.update-banner-text {
  flex: 1;
  line-height: 1.3;
}
.install-banner-btn,
.update-banner-btn {
  background: var(--md-primary);
  color: var(--md-on-primary);
  border: none;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .15s;
}
.install-banner-btn:active,
.update-banner-btn:active {
  opacity: .8;
}
.install-banner-close,
.update-banner-close {
  background: none;
  border: none;
  color: var(--md-on-surface-variant);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
}
.install-banner-close .material-icons-round,
.update-banner-close .material-icons-round {
  font-size: 18px;
}

/* Dark theme banner */
[data-theme="dark"] .install-banner,
[data-theme="dark"] .update-banner {
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
}

/* ===== Login ===== */
.login-body .app { display: flex; align-items: center; justify-content: center; }
.login-card {
  width: 100%;
  max-width: 340px;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-family: "Space Grotesk", "Inter", system-ui, sans-serif;
  letter-spacing: -0.02em;
}
.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}
.login-logo img { height: 100px; filter: brightness(0) invert(1); }
.login-title { font-size: 28px; font-weight: 600; letter-spacing: 1px; }
.login-sub { color: var(--md-on-surface-variant); margin-bottom: 20px; }

#login-form { width: 100%; display: flex; flex-direction: column; gap: 14px; }
.text-field {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--md-surface-container-high);
  border-radius: 12px;
  padding: 4px 16px;
  color: var(--md-on-surface-variant);
}
.text-field input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 16px;
  color: var(--md-on-surface);
  padding: 14px 0;
  min-width: 0;
}
.form-error { color: var(--md-error); font-size: 13px; text-align: center; }

/* Remember-me checkbox */
.remember-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--md-on-surface-variant);
  cursor: pointer;
  user-select: none;
  padding: 4px 0;
}
.remember-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--md-primary);
  cursor: pointer;
}

.btn-filled {
  border: none;
  border-radius: var(--radius-full);
  background: var(--md-primary);
  color: var(--md-on-primary);
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  padding: 14px;
  cursor: pointer;
  transition: filter .15s;
}
.btn-filled:active { filter: brightness(.9); }
.btn-text {
  border: none;
  background: transparent;
  color: var(--md-primary);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 10px;
  cursor: pointer;
  border-radius: var(--radius-full);
}
.btn-text:active { background: rgba(0,0,0,.1); }

.hidden { display: none !important; pointer-events: none; }

/* ===== Bottom sheet (template picker) ===== */
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 70;
  opacity: 0;
  transition: opacity .2s;
}
.sheet-backdrop.show { opacity: 1; }
.bottom-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--md-surface-container);
  border-radius: 24px 24px 0 0;
  padding: 8px 16px calc(env(safe-area-inset-bottom, 0px) + 20px);
  z-index: 71;
  transform: translateY(100%);
  transition: transform .25s ease;
}
.bottom-sheet.show { transform: translateY(0); }
.sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--md-outline);
  margin: 6px auto 12px;
  opacity: .5;
}
.sheet-title { font-size: 18px; font-weight: 500; margin: 0 8px 10px; }
.sheet-option {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  border: none;
  background: transparent;
  font: inherit;
  color: var(--md-on-surface);
  text-align: left;
  padding: 14px 12px;
  border-radius: 14px;
  cursor: pointer;
}
.sheet-option:active { background: var(--md-surface-container-high); }
.sheet-option .material-icons-round {
  font-size: 26px;
  color: var(--md-primary);
  background: var(--md-primary-container);
  border-radius: 12px;
  padding: 10px;
}
.option-text { display: flex; flex-direction: column; gap: 2px; }
.option-text strong { font-size: 16px; font-weight: 500; }
.option-text small { font-size: 13px; color: var(--md-on-surface-variant); }

/* ===== Input-method chooser sheet ===== */
#input-method-sheet .sheet-option {
  padding: 18px 14px;
  margin-bottom: 6px;
}
#input-method-sheet .sheet-option .material-icons-round {
  font-size: 30px;
  padding: 12px;
  border-radius: 14px;
}

/* ===== Keyboard mic FAB (floats above mobile keyboard) ===== */
.keyboard-mic-fab {
  position: absolute;
  right: 16px;
  bottom: 0;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  border: none;
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
  box-shadow: var(--md-elevation-2);
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: bottom .25s ease, opacity .2s, transform .2s;
  transform: translateY(-16px);
}
.keyboard-mic-fab .material-icons-round { font-size: 24px; }
.keyboard-mic-fab.recording {
  background: var(--md-error);
  color: #fff;
  animation: micPulse 1.2s infinite;
}
.keyboard-mic-fab.hidden { opacity: 0; pointer-events: none; transform: translateY(0); }

/* ===== Swipe bounce-back (top-level indicator) ===== */
@keyframes swipeBounceBack {
  0% { opacity: 1; transform: translateY(-50%) translateX(8px); }
  50% { opacity: .6; transform: translateY(-50%) translateX(16px); }
  100% { opacity: 0; transform: translateY(-50%) translateX(0); }
}
.edge-swipe-indicator.bounce {
  animation: swipeBounceBack .35s ease-out forwards;
}

/* ===== Note type chip ===== */
.note-type-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
  border-radius: var(--radius-full);
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 500;
  margin-top: 8px;
}
.note-type-chip .material-icons-round { font-size: 16px; }

/* ===== Archive banner ===== */
.archive-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
  font-size: 14px;
  font-weight: 500;
}
.archive-banner .material-icons-round { font-size: 20px; }
.archive-banner .icon-btn { margin-left: auto; }

/* Archive tab (notes list quick-toggle) */
.archive-tab-row {
  padding: 4px 16px 0;
}
.archive-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: none;
  border-radius: var(--radius-full);
  background: var(--md-surface-container);
  color: var(--md-on-surface-variant);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.archive-tab .material-icons-round { font-size: 18px; }
.archive-tab.active {
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
}
.archive-tab:active { background: var(--md-surface-container-high); }

/* Card type badge */
.type-badge {
  font-size: 14px !important;
  color: var(--md-primary);
}

/* ===== AI Summarize ===== */
.summarize-result {
  margin-top: 12px;
  padding: 14px 16px;
  background: var(--md-primary-container);
  border-radius: var(--radius-card);
  font-size: 14px;
  color: var(--md-on-primary-container);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.summarize-result strong { font-size: 13px; letter-spacing: .3px; opacity: .8; }
.summarize-result ul { list-style: none; padding: 0; margin: 0; }
.summarize-result li::before { content: "• "; opacity: .6; }
.summarize-result .sum-close {
  align-self: flex-end;
  background: transparent;
  border: none;
  color: var(--md-on-primary-container);
  cursor: pointer;
  border-radius: var(--radius-full);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: .6;
}

/* ===== Images ===== */
.images-section { margin-top: 12px; }
.images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
}
.images-grid .img-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid var(--md-outline);
}
.images-grid .img-delete {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0,0,0,.55);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
}
.images-grid .img-wrap {
  position: relative;
  display: inline-block;
}
/* Full-screen image viewer */
.image-viewer {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.9);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.image-viewer img {
  max-width: 95vw;
  max-height: 95vh;
  border-radius: 6px;
}
.image-viewer .viewer-close {
  position: absolute;
  top: 16px;
  right: 16px;
  color: #fff;
  background: none;
  border: none;
  font-size: 32px;
  cursor: pointer;
}

/* ===== Tables ===== */
.tables-section { margin-top: 12px; display: flex; flex-direction: column; gap: 12px; }
.note-table-wrap {
  background: var(--md-surface-container);
  border-radius: 10px;
  overflow: hidden;
}
.note-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.note-table td, .note-table th {
  border: 1px solid var(--md-outline-variant);
  padding: 8px 10px;
  min-width: 60px;
  text-align: left;
  vertical-align: top;
}
.note-table th {
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
  font-weight: 600;
  font-size: 12px;
  border-bottom: 2px solid var(--md-primary);
  position: relative;
  user-select: none;
  cursor: pointer;
  padding-right: 24px; /* room for sort indicator */
}
.note-table th:hover {
  background: var(--md-primary);
  color: var(--md-on-primary);
}
.sortable-th .th-content { display: block; }
.sortable-th input {
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-weight: 600;
  font-size: 12px;
  color: inherit;
  width: 100%;
  padding: 0;
  cursor: text;
}
.sort-indicator {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  opacity: 0.8;
  pointer-events: none;
}
.note-table td { color: var(--md-on-surface); }
/* Zebra striping */
.note-table tbody tr:nth-child(even) td,
.note-table tr:nth-child(even) td {
  background: rgba(0,0,0,.05);
}
[data-theme="dark"] .note-table tbody tr:nth-child(even) td,
[data-theme="dark"] .note-table tr:nth-child(even) td {
  background: rgba(255,255,255,.04);
}
/* Numeric column alignment */
.note-table td.col-numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: "SF Mono", "JetBrains Mono", "Cascadia Code", "Consolas", monospace;
  font-size: 13px;
}
.note-table td input {
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: inherit;
  width: 100%;
  padding: 2px 0;
}
.note-table td.col-numeric input {
  text-align: right;
  font-family: inherit;
}

/* Filter row */
.table-filter-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--md-surface-container-high);
  border-top: 1px solid var(--md-outline-variant);
}
.table-filter-row .material-icons-round {
  font-size: 18px;
  color: var(--md-on-surface-variant);
  flex-shrink: 0;
}
.table-filter-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--md-on-surface);
  padding: 4px 0;
}
.filter-count {
  font-size: 11px;
  color: var(--md-outline);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Table toolbar */
.table-toolbar {
  display: flex;
  gap: 4px;
  margin-top: 2px;
  padding: 2px 4px;
}
.table-toolbar button {
  font-size: 11px;
  border: 1px solid var(--md-outline-variant);
  background: transparent;
  color: var(--md-on-surface-variant);
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s;
}
.table-toolbar button:hover { background: var(--md-surface-container-highest); }
.table-toolbar button:active { background: var(--md-surface-container-high); }
.table-toolbar .table-delete-btn {
  margin-left: auto;
  color: var(--md-error);
  border-color: transparent;
}
.table-toolbar .sort-reset-btn { font-size: 13px; }

/* ===== Paste popover ===== */
.paste-popover {
  position: fixed;
  z-index: 100;
  background: var(--md-surface-container);
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,.18);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 220px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .15s ease, transform .15s ease;
  pointer-events: none;
}
.paste-popover.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.paste-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 14px;
  color: var(--md-on-surface);
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s;
}
.paste-opt:hover { background: var(--md-surface-container-high); }
.paste-opt:active { background: var(--md-surface-container-highest); }
.paste-opt .material-icons-round {
  font-size: 20px;
  color: var(--md-primary);
}

/* ===== Bulk bar ===== */
.bulk-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--md-primary-container);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 12px calc(env(safe-area-inset-bottom, 0px) + 10px);
  z-index: 60;
}
.bulk-bar span { flex: 1; font-size: 14px; font-weight: 500; color: var(--md-on-primary-container); }
.bulk-bar .icon-btn { color: var(--md-on-primary-container); }
/* Selection checkboxes */
.note-card .select-check {
  display: none;
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
}
.select-mode .note-card { padding-left: 42px; }
.select-mode .note-card .select-check {
  display: flex;
  width: 22px;
  height: 22px;
  border: 2px solid var(--md-outline);
  border-radius: 4px;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: transparent;
}
.select-mode .note-card.selected .select-check {
  border-color: var(--md-primary);
  background: var(--md-primary);
  color: #fff;
}

/* ===== Agent Panel ===== */
.agent-backdrop {
  position: absolute; inset: 0; z-index: 85;
  background: rgba(0,0,0,.4);
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}
.agent-backdrop.show { opacity: 1; pointer-events: auto; }

.agent-panel {
  position: absolute;
  inset: 0;
  z-index: 86;
  background: var(--md-surface);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.agent-panel.show { transform: translateY(0); }

.agent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 8px 8px 12px;
  border-bottom: 1px solid var(--checklist-border);
  background: var(--md-surface);
  flex-shrink: 0;
}
.agent-header-left {
  display: flex; align-items: center; gap: 8px;
  flex: 1; min-width: 0;
}
.agent-header-right {
  display: flex; align-items: center; gap: 2px;
}
.agent-avatar {
  font-size: 26px;
  color: var(--md-primary);
  background: var(--md-primary-container);
  border-radius: 12px;
  padding: 6px;
}
.agent-title { font-size: 16px; font-weight: 600; display: block; }
.agent-subtitle { font-size: 11px; color: var(--md-on-surface-variant); }

/* Quick-action chips */
.agent-chips {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex-shrink: 0;
  border-bottom: 1px solid var(--checklist-border);
}
.agent-chips::-webkit-scrollbar { display: none; }
.agent-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  border: 1px solid var(--md-outline);
  border-radius: var(--radius-full);
  padding: 7px 14px;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--md-on-surface);
  background: var(--md-surface-container);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}
.agent-chip:active { background: var(--md-surface-container-high); }
.agent-chip .material-icons-round { font-size: 16px; color: var(--md-primary); }

/* Messages area */
.agent-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.agent-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: var(--md-on-surface-variant);
  gap: 6px;
}
.agent-empty .material-icons-round { font-size: 48px; opacity: .4; }
.agent-empty p { font-size: 15px; font-weight: 500; }
.agent-empty small { font-size: 12px; opacity: .7; }

/* Message bubbles */
.agent-msg {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.45;
  animation: msgIn .2s ease;
}
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.agent-msg.user {
  align-self: flex-end;
  background: var(--md-primary);
  color: var(--md-on-primary);
  border-bottom-right-radius: 6px;
}
.agent-msg.agent {
  align-self: flex-start;
  background: var(--md-surface-container-high);
  color: var(--md-on-surface);
  border-bottom-left-radius: 6px;
}
.agent-msg.agent .agent-msg-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--md-primary);
  margin-bottom: 4px;
  display: block;
}
.agent-msg-body {
  font-size: 14px;
  line-height: 1.5;
}
.agent-msg-body p { margin: 0 0 6px; }
.agent-msg-body p:last-child { margin-bottom: 0; }
.agent-msg-body h1 { font-size: 1.3em; font-weight: 700; margin: 8px 0 4px; }
.agent-msg-body h2 { font-size: 1.15em; font-weight: 700; margin: 8px 0 4px; }
.agent-msg-body h3 { font-size: 1.05em; font-weight: 600; margin: 6px 0 3px; }
.agent-msg-body strong { font-weight: 600; }
.agent-msg-body em { font-style: italic; }
.agent-msg-body blockquote {
  border-left: 3px solid var(--md-primary);
  margin: 6px 0;
  padding: 4px 12px;
  color: var(--md-on-surface-variant);
  font-style: italic;
}
.agent-msg-body hr {
  border: none;
  border-top: 1px solid var(--checklist-border);
  margin: 8px 0;
}
.agent-msg-body code {
  background: rgba(0,0,0,.08);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: "SF Mono", "Consolas", monospace;
  font-size: 13px;
}
.agent-msg-body ul, .agent-msg-body ol {
  margin: 4px 0;
  padding-left: 18px;
}
.agent-msg-body li {
  margin: 2px 0;
  line-height: 1.4;
}

/* Tool step cards */
.agent-step {
  align-self: flex-start;
  max-width: 92%;
  background: var(--md-surface-container);
  border: 1px solid var(--checklist-border);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 12px;
  animation: msgIn .2s ease;
}
.agent-step-icon {
  font-size: 16px;
  margin-right: 6px;
  vertical-align: middle;
  color: var(--md-primary);
}
.agent-step-tool {
  font-weight: 600;
  color: var(--md-on-surface);
}
.agent-step-result {
  color: var(--md-on-surface-variant);
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.3;
  max-height: 60px;
  overflow: hidden;
}

/* Typing indicator */
.agent-typing {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  flex-shrink: 0;
}
.agent-typing-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--md-outline);
  animation: dotBounce 1.4s infinite ease-in-out;
}
.agent-typing-dot:nth-child(2) { animation-delay: .2s; }
.agent-typing-dot:nth-child(3) { animation-delay: .4s; }
@keyframes dotBounce { 0%,80%,100% { transform: scale(.6); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }
.agent-typing-label { font-size: 11px; color: var(--md-on-surface-variant); margin-left: 4px; }

/* Input row */
.agent-input-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px calc(env(safe-area-inset-bottom, 0px) + 8px);
  border-top: 1px solid var(--checklist-border);
  background: var(--md-surface);
  flex-shrink: 0;
}
.agent-input-wrap {
  flex: 1;
  background: var(--md-surface-container);
  border-radius: var(--radius-full);
  padding: 2px 4px;
}
.agent-input-wrap input {
  width: 100%;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 14px;
  color: var(--md-on-surface);
  padding: 10px 12px;
  outline: none;
  border-radius: var(--radius-full);
}
.agent-input-wrap input::placeholder { color: var(--md-outline); }
.agent-send-btn { color: var(--md-primary) !important; }
.agent-send-btn:disabled { opacity: .35; }

/* Confirmation card */
.agent-confirm-card {
  align-self: flex-start;
  max-width: 92%;
  background: var(--md-surface-container);
  border: 2px solid var(--md-primary);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: msgIn .2s ease;
}
.agent-confirm-icon {
  font-size: 24px;
  color: var(--md-primary);
}
.agent-confirm-body strong {
  font-size: 15px;
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
}
.agent-confirm-body p {
  font-size: 13px;
  color: var(--md-on-surface-variant);
  margin: 0;
}
.agent-confirm-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
}
.agent-confirm-ok {
  background: var(--md-primary) !important;
  color: var(--md-on-primary) !important;
  padding: 8px 20px;
  border-radius: var(--radius-full);
  border: none;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.agent-confirm-cancel {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--md-outline);
  background: transparent;
  color: var(--md-on-surface-variant);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

/* Conversation sidebar */
.agent-conv-sidebar {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 85%;
  max-width: 320px;
  background: var(--md-surface);
  z-index: 87;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--checklist-border);
  transform: translateX(-100%);
  transition: transform .25s ease;
}
.agent-conv-sidebar.show { transform: translateX(0); }
.agent-conv-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 8px 8px 16px;
  font-weight: 600;
  font-size: 16px;
  border-bottom: 1px solid var(--checklist-border);
}
.agent-conv-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.agent-conv-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--md-on-surface-variant);
  font-size: 13px;
}
.agent-conv-item {
  display: flex;
  flex-direction: column;
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--checklist-border);
  font: inherit;
  color: var(--md-on-surface);
}
.agent-conv-item:active, .agent-conv-item.active {
  background: var(--md-surface-container);
}
.agent-conv-title {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agent-conv-time {
  font-size: 11px;
  color: var(--md-on-surface-variant);
  margin-top: 2px;
}

/* ===== Calendar ===== */
.calendar-overlay {
  position: absolute; inset: 0; z-index: 80;
  background: var(--md-surface);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.calendar-modal { display: flex; flex-direction: column; height: 100%; }
.cal-header {
  display: flex; align-items: center; gap: 4px;
  padding: 8px 8px 4px;
}
.cal-header h2 { flex: 1; font-size: 16px; font-weight: 500; text-align: center; }
.cal-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr);
  text-align: center; font-size: 11px; font-weight: 500;
  color: var(--md-on-surface-variant); padding: 4px 8px 0;
}
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 2px; padding: 4px 8px; flex: 1;
  min-width: 0;
}
.cal-day {
  border-radius: 8px;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; font-size: 13px; cursor: pointer;
  position: relative; min-height: 36px; min-width: 0;
  overflow: hidden;
}
.cal-day:hover, .cal-day:active { background: var(--md-surface-container-high); }
.cal-day.today { background: var(--md-primary-container); font-weight: 600; }
.cal-day.other-month { color: var(--md-outline); opacity: .4; }
.cal-day .cal-dots {
  position: absolute; bottom: 4px; display: flex; gap: 2px;
}
.cal-dot {
  width: 5px; height: 5px; border-radius: 50%;
}
.cal-dot.meeting { background: #000000; }
.cal-dot.call { background: #2196F3; }
.cal-dot.memo { background: #FF9800; }
.cal-dot.note, .cal-dot.default { background: var(--md-outline); }
.cal-day-notes {
  display: flex; flex-direction: column; height: 100%;
}
.cal-day-notes .icon-btn { align-self: flex-start; }
#cal-day-label { font-size: 15px; font-weight: 500; padding: 0 12px 8px; }
#cal-day-list { flex: 1; overflow-y: auto; padding: 0 12px; }
.cal-note-item {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: 12px; cursor: pointer;
  margin-bottom: 4px; background: var(--md-surface-container);
}
.cal-note-item:active { background: var(--md-surface-container-high); }
.cal-note-item .cal-note-color {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.cal-note-item .cal-note-title { font-size: 14px; flex: 1; }
.cal-note-item .cal-note-time { font-size: 12px; color: var(--md-outline); }

/* ===== Audio player ===== */
.audio-section { margin-top: 10px; }
.audio-list { display: flex; flex-direction: column; gap: 6px; }
.audio-item {
  display: flex; align-items: center; gap: 8px;
  background: var(--md-surface-container); border-radius: 12px;
  padding: 6px 10px;
}
.audio-item audio { flex: 1; height: 32px; }
.audio-item .icon-btn { flex-shrink: 0; }

/* ===== Wiki links ===== */
.wiki-link {
  color: var(--md-primary);
  text-decoration: underline;
  cursor: pointer;
  font-weight: 500;
}
.wiki-autocomplete {
  position: absolute;
  background: var(--md-surface-container);
  border-radius: 12px;
  box-shadow: var(--shadow-3);
  max-height: 200px;
  overflow-y: auto;
  z-index: 50;
  padding: 4px 0;
}
.wiki-autocomplete .wiki-option {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  color: var(--md-on-surface);
}
.wiki-autocomplete .wiki-option:active { background: var(--md-surface-container-high); }
/* Backlinks section */
.backlinks-section {
  margin-top: 6px;
  padding: 6px 0;
  border-top: 1px solid var(--checklist-border);
  font-size: 12px;
}
.backlinks-section .backlink-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--md-surface-container-high);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  margin: 3px;
  cursor: pointer;
  font-size: 13px;
}

/* ===== Collapsible sections ===== */
.collapsible-section {
  border-top: 1px solid var(--checklist-border);
  padding-top: 8px;
  margin-top: 10px;
}
.section-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--md-on-surface-variant);
  cursor: pointer;
  padding: 3px 0;
  text-align: left;
  border-radius: 6px;
}
.section-toggle:active { background: var(--md-surface-container-high); }
.section-toggle .material-icons-round { font-size: 18px; }
.toggle-label { flex: 1; }
.toggle-count {
  font-size: 11px;
  color: var(--md-outline);
  font-weight: 400;
}
.toggle-icon {
  transition: transform .2s ease;
  color: var(--md-outline);
}
.section-toggle[aria-expanded="false"] .toggle-icon {
  transform: rotate(-90deg);
}
.collapsible-content {
  overflow: hidden;
  transition: max-height .25s ease, opacity .2s ease;
  max-height: 600px;
  opacity: 1;
}
.collapsible-content.collapsed {
  max-height: 0 !important;
  opacity: 0;
}

/* ===== Checklist ===== */
.checklist {
  list-style: none;
  max-height: 220px;
  min-height: 20px;
  overflow-y: auto;
  margin: 0 -2px;
  padding: 0 2px;
}
.checklist::-webkit-scrollbar { width: 3px; }
.checklist::-webkit-scrollbar-thumb { background: var(--md-outline); border-radius: 2px; opacity: .3; }
.checklist li {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0;
}
.checklist li .check-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: var(--radius-full);
  color: var(--md-outline);
  cursor: pointer;
  flex-shrink: 0;
}
.checklist li.done .check-toggle { color: var(--md-primary); }
.checklist li .check-text {
  flex: 1;
  font-size: 14px;
  color: var(--md-on-surface);
  word-break: break-word;
  padding: 5px 0;
}
.checklist li.done .check-text {
  text-decoration: line-through;
  color: var(--md-outline);
}
.check-edit-input {
  flex: 1;
  font: inherit;
  font-size: 14px;
  color: var(--md-on-surface);
  background: var(--md-surface-container-highest);
  border: 1px solid var(--md-primary);
  border-radius: 8px;
  padding: 4px 8px;
  margin: 2px 0;
  outline: none;
}
.checklist li .check-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: var(--radius-full);
  color: var(--md-outline);
  cursor: pointer;
  opacity: .6;
  flex-shrink: 0;
}
.checklist-add {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--md-outline);
  padding: 4px 0 4px 6px;
  flex-shrink: 0;
}
.checklist-add input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 14px;
  color: var(--md-on-surface);
  padding: 6px 0;
  min-width: 0;
}

/* Scrollbar */
::-webkit-scrollbar { width: 0; height: 0; }

/* ===== Google sign-in button ===== */
.login-divider {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 4px 0;
  color: var(--md-on-surface-variant);
  font-size: 13px;
}
.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--md-outline);
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  border: 1px solid var(--md-outline);
  border-radius: var(--radius-full);
  background: var(--md-surface);
  color: var(--md-on-surface);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  padding: 12px;
  cursor: pointer;
  transition: background .15s;
}
.btn-google:active { background: var(--md-surface-container-high); }
.btn-google .google-icon { flex-shrink: 0; }

/* ===== Sync button animation ===== */
#btn-sync .material-icons-round.syncing {
  animation: sync-spin 1s linear infinite;
}
@keyframes sync-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ===== Google Calendar chip in editor ===== */
.google-sync-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #e8f5e9;
  color: #2e7d32;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  margin-left: auto;
  white-space: nowrap;
}
[data-theme="dark"] .google-sync-chip {
  background: #1b5e20;
  color: #a5d6a7;
}

/* ===== Google settings sheet ===== */
.google-settings-body {
  padding: 8px 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.google-settings-status {
  font-size: 15px;
  font-weight: 600;
}
.google-settings-email {
  font-size: 13px;
  color: var(--md-on-surface-variant);
}
.google-settings-sync {
  font-size: 13px;
  color: var(--md-on-surface-variant);
}

/* ===== Sidebar navigation ===== */
.sidebar-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 90;
  opacity: 0;
  transition: opacity .25s ease;
  pointer-events: none;
}
.sidebar-scrim.show {
  opacity: 1;
  pointer-events: auto;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 300px;
  max-width: 85vw;
  background: var(--md-surface);
  z-index: 95;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform .25s ease;
  box-shadow: 2px 0 16px rgba(0,0,0,.15);
  overflow-y: auto;
}
.sidebar.show {
  transform: translateX(0);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 8px 10px 20px;
}
.sidebar-logo {
  font-family: "Space Grotesk", "Inter", system-ui, sans-serif;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--md-on-surface);
}

/* Sidebar sections */
.sidebar-section {
  padding: 8px 12px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 15px;
  color: var(--md-on-surface);
  padding: 12px 14px;
  border-radius: 14px;
  cursor: pointer;
  transition: background .12s;
  text-align: left;
  text-decoration: none;
}
.sidebar-item:hover { background: var(--md-surface-container); }
.sidebar-item:active { background: var(--md-surface-container-high); }
.sidebar-item.active { background: var(--md-primary-container); color: var(--md-on-primary-container); }
.sidebar-item .material-icons-round { font-size: 22px; flex-shrink: 0; }
.sidebar-label { flex: 1; }
.sidebar-badge {
  background: var(--md-error);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}

/* Hamburger menu badge */
.menu-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--md-error);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}
#btn-menu { position: relative; }

/* Inbox list */
.inbox-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: calc(100vh - 340px);
  overflow-y: auto;
}
.inbox-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 32px 16px;
  color: var(--md-on-surface-variant);
  text-align: center;
}
.inbox-empty .material-icons-round { font-size: 40px; opacity: .4; }
.inbox-empty small { font-size: 12px; opacity: .7; line-height: 1.4; }

.inbox-card {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: background .12s;
  background: var(--md-surface-container);
}
.inbox-card:hover { background: var(--md-surface-container-high); }
.inbox-card:active { background: var(--md-surface-container-highest); }
.inbox-card .inbox-card-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 14px;
}
.inbox-card-body { flex: 1; min-width: 0; }
.inbox-card-sender { font-size: 14px; font-weight: 500; }
.inbox-card-subject { font-size: 13px; color: var(--md-on-surface-variant); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-card-preview { font-size: 12px; color: var(--md-outline); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.inbox-card-time { font-size: 11px; color: var(--md-outline); flex-shrink: 0; margin-top: 2px; }

/* Inbox detail (email preview) */
.inbox-detail {
  display: flex;
  flex-direction: column;
  padding: 0;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}
.inbox-detail-content {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.inbox-detail-back {
  align-self: flex-start;
  margin: 4px;
}
.inbox-detail-sender { font-size: 13px; color: var(--md-on-surface-variant); }
.inbox-detail-subject { font-size: 16px; font-weight: 600; }

.inbox-ai-preview {
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.inbox-ai-preview .ai-label {
  font-size: 11px;
  font-weight: 600;
  opacity: .7;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.inbox-ai-preview .ai-title { font-size: 15px; font-weight: 600; }
.inbox-ai-preview .ai-body { font-size: 13px; line-height: 1.5; opacity: .9; }
.inbox-ai-checklist { list-style: none; padding: 0; margin: 0; }
.inbox-ai-checklist li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  padding: 3px 0;
}
.inbox-ai-checklist li::before { content: "☐"; flex-shrink: 0; }

.inbox-detail-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px calc(env(safe-area-inset-bottom, 0px) + 12px);
  border-top: 1px solid var(--md-surface-container-high);
}
.inbox-detail-actions .btn-filled {
  flex: 1;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
}
.inbox-detail-actions .btn-text {
  padding: 12px 16px;
  font-size: 14px;
}

/* Email address display */
.sidebar-email-section {
  border-top: 1px solid var(--md-surface-container-high);
  border-bottom: 1px solid var(--md-surface-container-high);
  padding: 10px 16px 12px;
}
.sidebar-email-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--md-on-surface-variant);
  margin-bottom: 8px;
}
.sidebar-email-info .material-icons-round { font-size: 18px; }

.sender-emails-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}
.sender-email-empty {
  font-size: 12px;
  color: var(--md-outline);
  font-style: italic;
}
.sender-email-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
}
.sender-email-tag .remove-sender {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  opacity: .6;
}
.sender-email-tag .remove-sender:hover { opacity: 1; }
.sender-email-tag .material-icons-round { font-size: 16px; }

.sender-email-add {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}
.sender-email-add input {
  flex: 1;
  border: 1px solid var(--md-outline-variant);
  border-radius: 8px;
  background: var(--md-surface);
  color: var(--md-on-surface);
  font: inherit;
  font-size: 13px;
  padding: 6px 10px;
  outline: none;
}
.sender-email-add input:focus { border-color: var(--md-primary); }

.sidebar-email-note {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--md-outline);
}
.sidebar-email-note code {
  font-size: 11px;
  color: var(--md-primary);
  word-break: break-all;
}
.sidebar-copy-btn { width: 28px; height: 28px; }
.sidebar-copy-btn .material-icons-round { font-size: 15px; }

.sidebar-nav-section { padding-top: 4px; }

/* ===== Contacts view ===== */
.view-contacts {
  display: flex;
  flex-direction: column;
}

.contacts-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 16px 0;
}

.contacts-tab {
  flex: 1;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--md-on-surface-variant);
  padding: 10px 0;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.contacts-tab.active {
  color: var(--md-primary);
  border-bottom-color: var(--md-primary);
}

.contacts-tab-badge {
  background: var(--md-error);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.contacts-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 100px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.contact-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--md-surface-container);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  transition: background .12s;
}

.contact-card:active {
  background: var(--md-surface-container-high);
}

.contact-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}

.contact-info {
  flex: 1;
  min-width: 0;
}

.contact-name {
  font-size: 15px;
  font-weight: 500;
}

.contact-since {
  font-size: 12px;
  color: var(--md-outline);
}

.contact-actions {
  display: flex;
  gap: 4px;
}

.request-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--md-surface-container);
  border-radius: var(--radius-card);
  padding: 14px 16px;
}

.request-card .btn-filled {
  font-size: 13px;
  padding: 8px 16px;
}

.request-card .btn-text {
  font-size: 13px;
  padding: 8px 12px;
}

/* ===== Find & Invite sheet ===== */
.find-search-section {
  padding: 8px 16px 0;
}

.find-search-bar {
  margin-bottom: 8px;
}

.find-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
}

.find-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: background .12s;
}

.find-result:hover {
  background: var(--md-surface-container);
}

.find-result-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}

.find-result-name {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
}

.find-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 8px;
  color: var(--md-outline);
  font-size: 12px;
}

.find-divider::before,
.find-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--md-surface-container-high);
}

.invite-section {
  padding: 8px 16px calc(env(safe-area-inset-bottom, 0px) + 16px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.invite-section .text-field {
  background: var(--md-surface-container-high);
  border-radius: 12px;
  padding: 4px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.invite-section .text-field input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 15px;
  color: var(--md-on-surface);
  padding: 12px 0;
}

.invite-section .btn-filled {
  font-size: 15px;
  padding: 14px;
  border-radius: var(--radius-full);
}

.invite-link-result {
  background: var(--md-primary-container);
  border-radius: 12px;
  padding: 12px 14px;
}

.invite-link-result p {
  font-size: 12px;
  color: var(--md-on-primary-container);
  opacity: .7;
  margin-bottom: 6px;
}

.invite-link-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.invite-link-row code {
  flex: 1;
  font-size: 12px;
  color: var(--md-on-primary-container);
  word-break: break-all;
  background: rgba(0,0,0,.08);
  padding: 4px 8px;
  border-radius: 6px;
}

/* ===== Share sheet ===== */
.share-search-section {
  padding: 8px 16px 0;
}

.share-search-bar {
  margin-bottom: 8px;
}

.share-friend-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
}

.share-friend-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: background .12s;
  border: none;
  background: transparent;
  font: inherit;
  color: var(--md-on-surface);
  width: 100%;
  text-align: left;
}

.share-friend-option:hover {
  background: var(--md-surface-container);
}

.share-friend-option:active {
  background: var(--md-surface-container-high);
}

.share-friend-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}

.share-friend-name {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
}

.share-friend-check {
  color: var(--md-primary);
  font-size: 20px;
}

.share-permission-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--md-surface-container-high);
  border-bottom: 1px solid var(--md-surface-container-high);
  margin: 8px 0;
}

.share-permission-label {
  font-size: 14px;
  color: var(--md-on-surface-variant);
}

.share-permission-toggle {
  display: flex;
  gap: 4px;
  background: var(--md-surface-container-high);
  border-radius: 10px;
  padding: 3px;
}

.perm-chip {
  border: none;
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--md-on-surface-variant);
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.perm-chip.active {
  background: var(--md-primary);
  color: var(--md-on-primary);
}

.share-current-section {
  padding: 8px 16px 12px;
}

.share-current-title {
  font-size: 13px;
  color: var(--md-on-surface-variant);
  margin-bottom: 6px;
}

.share-current-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.share-current-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--md-surface-container);
  border-radius: 10px;
  font-size: 14px;
}

.share-current-item .contact-avatar {
  width: 30px;
  height: 30px;
  font-size: 13px;
}

.share-current-perm {
  font-size: 11px;
  color: var(--md-outline);
  background: var(--md-surface-container-high);
  padding: 2px 8px;
  border-radius: 6px;
}

.share-current-item .icon-btn {
  margin-left: auto;
  width: 30px;
  height: 30px;
}

.share-export-row {
  padding: 8px 16px calc(env(safe-area-inset-bottom, 0px) + 12px);
  border-top: 1px solid var(--md-surface-container-high);
  margin-top: 8px;
}

/* ===== Shared note banner ===== */
.shared-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
  font-size: 13px;
  font-weight: 500;
}

.shared-banner .material-icons-round {
  font-size: 18px;
}

.shared-banner-readonly {
  background: var(--md-surface-container-high);
  color: var(--md-on-surface-variant);
}

/* Shared note card indicator */
.note-card.shared-card {
  border-left: 3px solid var(--md-primary);
}

.note-card .shared-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--md-primary);
  margin-top: 4px;
}

.note-card .shared-indicator .material-icons-round {
  font-size: 14px;
}

/* ===== Bottom navigation (mobile only) ===== */
.bottom-nav {
  display: none;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--md-surface-container);
  border-top: 1px solid var(--md-surface-container-high);
  justify-content: space-around;
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 50;
}

@media (max-width: 599px) {
  .bottom-nav {
    display: flex;
  }

  /* Hide standalone FABs on mobile — bottom nav handles everything */
  .fab {
    display: none;
  }

  .fab-mic {
    display: none;
  }

  /* Adjust notes list padding for bottom nav */
  .notes-list {
    padding-bottom: 90px;
  }

  /* Adjust editor body for bottom nav */
  .editor-body {
    padding-bottom: 80px;
  }

  /* Adjust snackbar position */
  .snackbar {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 80px);
  }

  /* Push bottom sheets above the nav bar */
  .bottom-sheet {
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 80px);
  }

  /* Adjust editor status & word count for bottom nav */
  .editor-status {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 74px);
  }

  .word-count {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 74px);
  }

  /* Ensure sheet backdrop covers nav */
  .sheet-backdrop.show {
    z-index: 75;
  }

  .bottom-sheet.show {
    z-index: 76;
  }
}

.bottom-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: none;
  background: transparent;
  color: var(--md-on-surface-variant);
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 12px;
  transition: background .15s, color .15s;
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav-btn:active {
  background: var(--md-surface-container-high);
}

.bottom-nav-btn .material-icons-round {
  font-size: 24px;
}

.bottom-nav-label {
  font-size: 10px;
  font-weight: 500;
}

/* Center button — larger, elevated, primary color */
.bottom-nav-center {
  position: relative;
  top: -18px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--md-primary);
  color: var(--md-on-primary);
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
  padding: 0;
  gap: 0;
}

.bottom-nav-center:active {
  background: var(--md-primary);
  filter: brightness(.85);
}

.bottom-nav-center .material-icons-round {
  font-size: 28px;
}

/* Mic recording state on center button */
.bottom-nav-center.recording {
  background: var(--md-error);
  color: #fff;
  animation: mic-pulse 1.4s infinite;
}

/* Mic recording state on regular nav buttons (e.g. Dictate) */
.bottom-nav-btn.recording {
  background: #D32F2F;
  color: #fff;
  border-radius: 14px;
}
.bottom-nav-btn.recording .material-icons-round {
  animation: nav-mic-pulse 1.2s infinite;
}
@keyframes nav-mic-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.25); }
}

/* ===== Smart upload process sheet ===== */
.smart-process-body {
  padding: 0 16px calc(env(safe-area-inset-bottom, 0px) + 16px);
}

.smart-process-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 0;
  color: var(--md-on-surface-variant);
}

.smart-process-loading .material-icons-round {
  font-size: 40px;
  color: var(--md-primary);
}

.spinning {
  animation: spin 1.2s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.smart-field {
  margin-bottom: 12px;
}

.smart-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--md-on-surface-variant);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.smart-field input,
.smart-field textarea {
  width: 100%;
  border: 1px solid var(--md-outline);
  border-radius: 10px;
  padding: 10px 14px;
  font: inherit;
  font-size: 15px;
  color: var(--md-on-surface);
  background: var(--md-surface);
  outline: none;
  resize: vertical;
}

.smart-field input:focus,
.smart-field textarea:focus {
  border-color: var(--md-primary);
}

.smart-checklist label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--md-on-surface-variant);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.smart-checklist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 14px;
}

.smart-checklist-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--md-primary);
}

.smart-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--md-surface-container-high);
}

.smart-actions .btn-filled {
  font-size: 15px;
  padding: 14px;
}

/* Dark theme overrides for agent markdown */
[data-theme="dark"] .agent-msg-body code {
  background: rgba(255,255,255,.1);
}
[data-theme="dark"] .agent-msg-body blockquote {
  color: var(--md-on-surface-variant);
}
[data-theme="dark"] .agent-msg-body h1,
[data-theme="dark"] .agent-msg-body h2,
[data-theme="dark"] .agent-msg-body h3 {
  color: var(--md-on-surface);
}
