* {
  box-sizing: border-box;
}

html,
body,
#root {
  height: 100%;
  margin: 0;
}

* {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

*::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

select option {
  background-color: var(--surface);
  color: var(--text);
}

body {
  font-family:
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.icon-btn:focus-visible {
  outline: none;
}

.search-bar input:focus-visible {
  outline: none;
}

.editor-title-input:focus-visible,
.editor-content-input:focus-visible,
.note-title-input:focus-visible {
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

h1,
h2,
h3,
p {
  margin: 0;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

input,
textarea,
select {
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s ease;
}

select option {
  background-color: var(--surface-2);
  color: var(--text);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
}

textarea {
  resize: vertical;
  min-height: 140px;
}

::placeholder {
  color: var(--muted-dim);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius);
  padding: 9px 16px;
  font-weight: 500;
  transition:
    background-color 0.15s ease,
    opacity 0.15s ease;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13.5px;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-bright);
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-ghost {
  color: var(--muted);
}

.btn-ghost:hover {
  color: var(--text);
  background: var(--surface-2);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  color: var(--muted);
  transition:
    color 0.15s ease,
    background-color 0.15s ease;
}

.icon-btn:hover {
  color: var(--text);
  background: var(--surface-2);
}

.icon-btn.danger:hover {
  color: var(--danger);
}

.icon-btn.subtle {
  width: 26px;
  height: 26px;
}

.favorite-btn.is-active {
  color: var(--favorite);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
}

.chip-deadline {
  color: var(--accent-soft);
}

.chip-high {
  background: rgba(201, 106, 95, 0.16);
  color: #e2938a;
}

.chip-medium {
  background: rgba(83, 104, 212, 0.14);
  color: var(--accent-soft);
}

.chip-low {
  background: rgba(127, 191, 160, 0.12);
  color: #93c9ab;
}

.ref-badge {
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ref);
  font-variant-numeric: tabular-nums;
}

.status-pill {
  flex-shrink: 0;
  align-self: flex-start;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--ok);
  min-width: 86px;
  text-align: center;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease;
}

.status-pill:hover {
  background: var(--surface-2);
  border-color: var(--muted-dim);
}

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 14px 0 5px;
}

.select-wrap {
  position: relative;
  display: inline-block;
  width: 100%;
}

.select-wrap select {
  appearance: none;
  padding-right: 30px;
}

.select-wrap svg {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--muted);
}

.radio-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.radio-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.radio-pill input {
  width: auto;
  accent-color: var(--accent);
  margin: 0;
}

.radio-pill.is-active {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(83, 104, 212, 0.08);
}
.app {
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 760px;
  margin: 0 auto;
}

.status-bar-strip {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: env(safe-area-inset-top, 0px);
  background: #f4f5f9;
  z-index: 10;
  pointer-events: none;
}

.app-content {
  position: relative;
  z-index: 1;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

.app-content::-webkit-scrollbar {
  display: none;
}

.fab {
  position: fixed;
  right: 20px;
  bottom: calc(86px + env(safe-area-inset-bottom));
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--fab-color);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
  z-index: 55;
  transition:
    background-color 0.15s ease,
    transform 0.15s ease;
}

.fab:hover {
  background: var(--fab-color-hover);
}

.fab:active {
  transform: scale(0.94);
}

@media (max-width: 1023.98px) {
  .fab {
    display: none;
  }
}

@media (min-width: 760px) {
  .fab {
    right: calc(50% - 360px);
  }
}

.side-nav {
  display: none;
}

@media (min-width: 1024px) {
  .app {
    flex-direction: row;
    max-width: none;
  }

  .side-nav {
    display: flex;
    flex-direction: column;
    width: 230px;
    flex-shrink: 0;
    height: 100%;
    border-right: 1px solid var(--border);
    background: var(--nav-bg);
    padding: 24px 12px;
    gap: 8px;
  }

  .side-nav-brand {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--accent);
    padding: 0 12px;
    margin-bottom: 12px;
  }

  .side-nav-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .side-nav .bottom-nav-item {
    width: 100%;
    justify-content: flex-start;
    padding: 10px 14px;
    border-radius: var(--radius);
  }

  .side-nav .bottom-nav-item.is-active {
    background: transparent;
    box-shadow: none;
    color: var(--accent);
  }

  .side-nav-footer {
    margin-top: auto;
  }

  .app-content {
    padding-bottom: 40px;
  }

  .app-content .page {
    max-width: 760px;
    margin: 0 auto;
    width: 100%;
  }

  .fab {
    right: 24px;
    bottom: 28px;
  }

  .offline-indicator {
    left: calc(50% + 115px);
  }
}

.page {
  padding: calc(env(safe-area-inset-top, 0px) + 20px) 18px 40px;
}

.page:has(.deck-stage) {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 20px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}

.sync-pill-wrap {
  position: relative;
}

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

.sync-icon-btn:hover {
  border-color: var(--muted-dim);
  color: var(--text);
}

.sync-icon-btn.has-error {
  color: var(--danger);
  border-color: var(--danger);
}

.sync-icon-btn.is-spinning {
  color: var(--accent);
  border-color: var(--accent);
}

.sync-icon-btn.is-spinning svg {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.sync-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.sync-attention {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 260px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  z-index: 70;
  font-size: 13px;
  color: var(--text);
}

.sync-attention p {
  margin: 0 0 8px;
}

.sync-error-detail {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.sync-attention-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 6px 4px 12px;
  color: var(--muted);
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.search-bar input {
  border: none;
  background: transparent;
  padding: 4px 0;
  min-width: 160px;
}

.search-bar input:focus {
  border: none;
}

.search-status {
  text-align: center;
  color: var(--muted);
  padding: 40px 16px;
}

.archive-entry {
  display: flex;
  justify-content: center;
  padding: 18px 0 4px;
}

.archive-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.state-archived {
  background: rgba(150, 150, 160, 0.15);
}

.state-completed {
  background: rgba(127, 191, 148, 0.14);
  color: var(--ok);
}

.state-pending,
.state-active {
  color: var(--accent-soft);
}

.state-in_progress,
.state-paused {
  color: var(--muted);
}

.time-name {
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  text-wrap: balance;
  color: var(--text);
}

.time-name-field {
  width: 100%;
  margin-bottom: 4px;
}

.settings-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  padding: 14px 16px;
}

.settings-subheading {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 10px;
}

.settings-line {
  font-size: 14px;
  margin-bottom: 10px;
}

.settings-line.muted {
  color: var(--muted);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

.settings-note {
  font-size: 12.5px;
  color: var(--muted-dim);
  margin-top: 10px;
}

.settings-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.theme-row {
  display: flex;
  gap: 8px;
}

.theme-option {
  flex: 1;
  padding: 8px 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  transition:
    border-color 0.15s ease,
    color 0.15s ease,
    background-color 0.15s ease,
    transform 0.15s ease;
}

.theme-option:hover {
  border-color: var(--muted-dim);
  color: var(--text);
  transform: translateY(-1px);
}

.theme-option.is-active {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(83, 104, 212, 0.08);
}

.page-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-wrap: balance;
  color: var(--text);
}

.bottom-nav {
  position: fixed;
  bottom: calc(10px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 728px;
  height: 66px;
  border-radius: 33px;
  background: rgba(238, 238, 244, 0.9);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(28, 29, 46, 0.08);
  box-shadow: 0 10px 24px rgba(28, 29, 46, 0.18);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 50;
}

.bottom-nav-gap {
  width: 48px;
  height: 44px;
  flex-shrink: 0;
}

.bottom-nav-add {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #6c4dff;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 8px rgba(28, 29, 46, 0.18);
  z-index: 1;
  transition: transform 0.15s ease;
}

.bottom-nav-add:active {
  transform: translate(-50%, -50%) scale(0.94);
}

.bottom-nav-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #9c9db2;
  transition:
    color 0.15s ease,
    transform 0.15s ease;
  white-space: nowrap;
}

.bottom-nav-item:hover {
  color: #6c4dff;
}

.bottom-nav-item.is-active {
  background: transparent;
  color: #6c4dff;
  box-shadow: none;
}

.bottom-nav-item.is-active svg {
  color: #6c4dff;
}

.bottom-nav-item:active {
  transform: scale(0.96);
}

.side-nav .bottom-nav-item {
  width: 100%;
  height: auto;
  justify-content: flex-start;
  color: var(--muted-dim);
}

.side-nav .bottom-nav-item:hover {
  color: var(--muted);
}

.side-nav .bottom-nav-item.is-active,
.side-nav .bottom-nav-item.is-active svg {
  background: transparent;
  box-shadow: none;
  color: var(--accent);
}

@media (min-width: 1024px) {
  .bottom-nav {
    display: none;
  }
}

.offline-indicator {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 12.5px;
  color: var(--muted);
  z-index: 60;
}

.exit-toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 20px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  z-index: 70;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  animation: toast-in 0.2s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.deep-link-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg, #0e1117);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.deep-link-overlay-content {
  text-align: center;
  color: var(--text, #e0e0e0);
  font-size: 15px;
  font-weight: 500;
}

.deep-link-overlay-content p {
  margin-top: 1rem;
}

/* Auth screen */
.auth-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

.auth-container {
  width: 100%;
  max-width: 400px;
}

.auth-brand-section {
  text-align: center;
  margin-bottom: 36px;
}

.auth-logo {
  margin-bottom: 16px;
}

.auth-logo svg {
  display: inline-block;
}

.auth-title {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  margin: 0 0 6px;
}

.auth-subtitle {
  font-size: 15px;
  color: var(--muted);
  margin: 0;
}

.auth-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.auth-input-group {
  margin-bottom: 18px;
}

.auth-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.auth-input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

.auth-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(83, 104, 212, 0.15);
}

.auth-input::placeholder {
  color: var(--muted-dim);
}

.auth-input:disabled {
  opacity: 0.6;
}

.auth-error {
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--danger);
  background: rgba(201, 106, 95, 0.1);
  border: 1px solid rgba(201, 106, 95, 0.2);
}

.auth-notice {
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ok);
  background: rgba(127, 191, 148, 0.1);
  border: 1px solid rgba(127, 191, 148, 0.2);
}

.auth-submit {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.auth-submit:hover {
  background: var(--accent-bright);
}

.auth-submit:active {
  transform: scale(0.98);
}

.auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(16, 20, 24, 0.3);
  border-top-color: #101418;
  border-radius: 50%;
  animation: auth-spin 0.6s linear infinite;
}

@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
}

.auth-switch {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

.auth-link {
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
}

.auth-link:hover {
  color: var(--accent-bright);
  text-decoration: underline;
}

.note-editor-full {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding-bottom: 0;
  overflow: hidden;
}

@media (max-width: 768px) {
  .note-editor-full {
    padding-left: 0;
    padding-right: 0;
  }
}

.overlay-backdrop.align-top > div > .note-editor-full {
  height: 100%;
}

.save-indicator {
  flex: 1;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
}

.conflict-banner {
  background: rgba(255, 152, 0, 0.12);
  border-bottom: 1px solid rgba(255, 152, 0, 0.3);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.conflict-banner-text {
  font-size: 13px;
  color: #ffb74d;
  margin: 0;
  flex: 1;
}

.conflict-banner-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.editor-scroll-indicator {
  position: absolute;
  right: 3px;
  top: 0;
  bottom: 0;
  width: 3px;
  background: transparent;
  border-radius: 3px;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.editor-scroll-indicator-bar {
  position: absolute;
  top: 0;
  width: 100%;
  background: var(--accent);
  border-radius: 3px;
  opacity: 0.4;
  transition: opacity 0.2s ease;
}

.editor-scroll-indicator:hover .editor-scroll-indicator-bar {
  opacity: 0.7;
}

@media (min-width: 1024px) {
  .editor-scroll-gutter {
    width: 14px;
  }
}

.editor-topbar-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

/* Note export menu */
.note-export-menu {
  position: relative;
}

.note-export-trigger {
  opacity: 0.7;
  transition: opacity 0.15s;
}

.note-export-trigger:hover {
  opacity: 1;
}

.note-export-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 200;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  padding: 4px;
  margin-top: 4px;
}

.note-export-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 13px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s;
}

.note-export-item:hover {
  background: var(--bg);
}

.note-export-item:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.note-export-item svg {
  flex-shrink: 0;
  opacity: 0.6;
}

.editor-title-input {
  border: none;
  background: transparent;
  font-size: 24px;
  font-weight: 700;
  padding: 8px 0 4px;
  border-radius: 0;
  flex-shrink: 0;
}

.editor-title-input:focus {
  border: none;
}

.editor-content-input {
  flex: 1;
  min-height: 0;
  border: none;
  background: transparent;
  font-size: 16px;
  line-height: 1.75;
  padding: 6px 0 12px;
  resize: none;
  overflow-y: auto;
  border-radius: 0;
}

.editor-content-input:focus {
  border: none;
}

.editor-category-select {
  width: auto;
  max-width: 160px;
  font-size: 12.5px;
  color: var(--muted-dim);
  background: var(--surface);
  border-color: transparent;
  padding: 4px 6px;
}

.editor-category-select:hover,
.editor-category-select:focus {
  color: var(--text);
  border-color: transparent;
}

.category-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.category-new {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.group-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent);
  margin: 24px 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.group-label svg {
  color: var(--accent);
  opacity: 0.8;
}

.list-item-wrap + .list-item-wrap,
.list-item + .list-item {
  margin-top: 8px;
}

.note-group .list-item + .list-item {
  margin-top: 8px;
}

.list-item,
.due-item {
  display: flex;
  width: 100%;
  text-align: left;
  gap: 12px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  box-shadow: var(--card-shadow);
  transition:
    border-color 0.2s ease,
    background-color 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
  content-visibility: auto;
  contain-intrinsic-size: auto 76px;
}

.list-item:hover,
.due-item:hover {
  border-color: var(--accent-soft);
  background: var(--surface);
  transform: translateY(-1px);
  box-shadow: var(--card-shadow-hover);
}

.list-item:active,
.due-item:active {
  transform: translateY(0);
  box-shadow: none;
  transition-duration: 0.05s;
}

.list-item-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.due-item > .list-item-main {
  margin-top: 0;
}

.list-item-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.star-inline {
  color: var(--favorite);
  flex-shrink: 0;
}

.pin-inline {
  color: var(--accent);
  flex-shrink: 0;
}

.list-item-snippet {
  font-size: 13.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 3px;
}

.list-item-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.item-time {
  font-size: 11.5px;
  color: var(--muted-dim);
  font-variant-numeric: tabular-nums;
  margin-left: auto;
}

.is-completed .list-item-title {
  text-decoration: line-through;
  color: var(--muted);
}

.add-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  padding: 16px 18px;
}

/* Mobile web/PWA responsive: full-width editor on phones */
@media (max-width: 768px) {
  .app {
    max-width: 100%;
  }

  .page {
    padding: 16px 12px 40px;
  }

  .note-editor-full {
    padding-left: 0;
    padding-right: 0;
  }

  .overlay-backdrop.align-top > div > .note-editor-full {
    width: 100%;
    max-width: 100%;
  }

  .app-content .page {
    max-width: 100%;
  }

  .search-bar input {
    min-width: 0;
  }
}

/* Desktop overrides for editor in sidebar layout */
@media (min-width: 1024px) {
  .note-editor-full {
    max-width: 760px;
    margin: 0 auto;
  }
}

/* Form overlay: list stays visible behind */
.overlay-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 24px;
  padding-bottom: 80px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.3);
  -webkit-overflow-scrolling: touch;
}

.overlay-backdrop > div {
  width: 100%;
  max-width: 560px;
}

.overlay-backdrop.align-top {
  align-items: stretch;
  padding: 0;
  background: none;
  overflow: hidden;
}

.overlay-backdrop.align-top > div {
  max-width: none;
}

@media (min-width: 1024px) {
  .overlay-backdrop.align-top {
    left: 230px;
    width: calc(100vw - 230px);
    padding: 0;
  }
}

/* Mobile form + keyboard layout */
@media (max-width: 768px) {
  .overlay-backdrop {
    padding: 12px;
    padding-bottom: 12px;
    align-items: flex-end;
    overscroll-behavior: contain;
  }

  .overlay-backdrop.align-top {
    padding: 12px;
    padding-bottom: 0;
  }

  .overlay-backdrop > div {
    max-width: 100%;
    margin-bottom: env(safe-area-inset-bottom, 0px);
  }

  .add-form {
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
}

/* Editor header bar: fixed, not scrollable */
.editor-topbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  flex-shrink: 0;
  z-index: 10;
  padding-top: env(safe-area-inset-top, 0px);
}

.add-form textarea {
  min-height: 0;
}

.form-title {
  font-size: 17px;
  font-weight: 700;
}

.row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.deck-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding-top: 8px;
  justify-content: center;
  flex: 1;
  min-height: 0;
  width: 100%;
}

.deck-stage > .page-header {
  flex-shrink: 0;
}

.deck-counter {
  font-size: 12px;
  color: var(--muted-dim);
  font-variant-numeric: tabular-nums;
}

.time-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  padding-top: 26px;
}

.time-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.time-number {
  font-size: 84px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.time-number.small {
  font-size: 44px;
  color: var(--text);
}

.time-caption {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.time-settings {
  display: flex;
  gap: 14px;
  width: 100%;
  max-width: 360px;
  margin-top: 8px;
}

.time-settings > div {
  flex: 1;
}

.time-enddate {
  font-size: 13.5px;
  color: var(--muted);
}

.error-boundary {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
}

.error-boundary pre {
  max-width: 560px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--danger);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
}

.error-hint {
  font-size: 13.5px;
  color: var(--muted);
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}

.empty-icon {
  color: var(--muted-dim);
  margin-bottom: 10px;
}

.empty-title {
  font-weight: 600;
}

.empty-hint {
  font-size: 13.5px;
  color: var(--muted-dim);
  margin-top: 4px;
}

@media (max-width: 540px) {
  .row-2col {
    grid-template-columns: 1fr;
  }

  .time-number {
    font-size: 64px;
  }
}

/* Editor scrollable area */
.editor-scroll {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.rich-editor {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.rich-editor-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: 52px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.rich-editor-body::-webkit-scrollbar {
  display: none;
}

.editor-content-gutter {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

.editor-content-gutter .rich-editor {
  flex: 1;
  min-width: 0;
}

.editor-scroll-gutter {
  width: 10px;
  flex-shrink: 0;
  position: relative;
}

.rich-editor-body .tiptap {
  outline: none;
  min-height: 200px;
  padding: 12px 0;
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
}

.rich-editor-body .tiptap p.is-editor-empty:first-child::before {
  color: var(--muted-dim);
  content: attr(data-placeholder);
  float: left;
  height: 0;
  pointer-events: none;
}

.rich-editor-body .tiptap h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 16px 0 8px;
}

.rich-editor-body .tiptap h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 14px 0 6px;
}

.rich-editor-body .tiptap h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 12px 0 4px;
}

.rich-editor-body .tiptap img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 0;
  display: none;
}

.rich-editor-body .tiptap img:hover {
  opacity: 0.85;
}

.rich-editor-body .tiptap blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 12px;
  margin: 8px 0;
  color: var(--muted);
}

.rich-editor-body .tiptap ul,
.rich-editor-body .tiptap ol {
  padding-left: 24px;
  margin: 8px 0;
}

.rich-editor-body .tiptap ul li,
.rich-editor-body .tiptap ol li {
  margin: 2px 0;
}

.rich-editor-body .tiptap code {
  background: var(--surface-2);
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 0.9em;
}

.rich-editor-body .tiptap hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

.rich-editor-body .tiptap .text-box-block {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin: 8px 0;
  background: var(--surface-2);
  min-height: 40px;
}

.rich-editor-body .tiptap .text-box-block:focus {
  border-color: var(--accent);
  outline: none;
}

/* Image gallery above title */
.image-gallery {
  display: flex;
  gap: 6px;
  padding: 8px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
}

.image-gallery::-webkit-scrollbar {
  display: none;
}

.image-gallery-item {
  position: relative;
  flex-shrink: 0;
  width: 100px;
  height: 100px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  cursor: pointer;
}

.image-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-gallery-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  border: none;
  padding: 0;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.image-gallery-item:hover .image-gallery-remove,
.image-gallery-item:active .image-gallery-remove {
  opacity: 1;
  pointer-events: auto;
}

/* Touch devices: show remove button on tap via touch class */
.image-gallery-item.touch-active .image-gallery-remove {
  opacity: 1;
  pointer-events: auto;
}

.image-upload-input {
  display: none;
}

/* Toolbar — fixed at bottom */
.editor-toolbar {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 760px;
  z-index: 100;
}

@media (max-width: 768px) {
  .editor-toolbar {
    max-width: 100%;
    left: 0;
    right: 0;
    transform: none;
  }
}

@media (min-width: 1024px) {
  .editor-toolbar {
    left: calc(50% + 115px);
    transform: translateX(-50%);
  }
}

.editor-toolbar-scroll {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.editor-toolbar-scroll::-webkit-scrollbar {
  display: none;
}

.editor-toolbar-divider {
  width: 1px;
  height: 22px;
  background: var(--border);
  margin: 0 4px;
  flex-shrink: 0;
}

.editor-tool-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  border-radius: 6px;
  color: var(--muted);
  transition: background-color 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}

.editor-tool-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.editor-tool-btn.is-active {
  background: var(--accent);
  color: #ffffff;
}

.toolbar-label {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* Dropdown menus */
.toolbar-dropdown {
  position: relative;
  flex-shrink: 0;
}

.toolbar-dropdown-backdrop {
  position: fixed;
  inset: 0;
  z-index: 110;
}

.toolbar-dropdown-menu {
  position: fixed;
  z-index: 120;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  min-width: 120px;
  max-height: 60vh;
  overflow-y: auto;
}

.toolbar-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--muted);
  text-align: left;
  transition: background-color 0.1s ease, color 0.1s ease;
}

.toolbar-dropdown-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.toolbar-dropdown-item.is-active {
  color: var(--accent);
  font-weight: 600;
}

.toolbar-color-grid {
  display: flex;
  gap: 6px;
  padding: 4px;
}

.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.color-swatch:hover {
  transform: scale(1.15);
}

.color-swatch.is-active {
  border-color: var(--text);
}

.read-aloud-highlight {
  background-color: rgba(255, 220, 80, 0.35);
  border-radius: 2px;
  transition: background-color 0.15s ease;
}

/* Image lightbox viewer */
.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
  touch-action: pan-y;
  overflow: hidden;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.image-lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 4px;
  user-select: none;
  -webkit-user-drag: none;
  transition: transform 0.15s ease;
  touch-action: pan-y;
}

.image-lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  font-size: 18px;
  z-index: 210;
  transition: background 0.15s ease;
}

.image-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.image-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  font-size: 20px;
  z-index: 210;
  transition: background 0.15s ease;
}

.image-lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.3);
}

.image-lightbox-prev {
  left: 16px;
}

.image-lightbox-next {
  right: 16px;
}

.image-lightbox-counter {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  font-weight: 600;
}

/* Hide nav arrows on touch devices — use swipe instead */
@media (hover: none) and (pointer: coarse) {
  .image-lightbox-nav {
    display: none;
  }
}

.image-placeholder-offline {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px 16px;
  margin: 8px 0;
  border: 2px dashed var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-secondary);
  min-height: 80px;
}

.image-placeholder-icon {
  font-size: 28px;
  opacity: 0.5;
}

.image-placeholder-text {
  font-size: 13px;
  font-weight: 500;
}

/* Text box block in tiptap */
.text-box-block {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin: 8px 0;
  background: var(--surface-2);
  min-height: 40px;
  width: 100%;
  box-sizing: border-box;
}

.text-box-block:focus {
  border-color: var(--accent);
  outline: none;
}

/* Text Box TipTap node */
.text-box-node {
  margin: 8px 0;
}

.text-box-inner {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--surface-2);
}

.text-box-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-dim);
  margin-bottom: 4px;
}

.text-box-input {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  line-height: 1.6;
  resize: vertical;
  min-height: 36px;
  padding: 4px 0;
  outline: none;
}

.text-box-input::placeholder {
  color: var(--muted-dim);
}

/* Biometric lock screen */
.biometric-lock-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
}

.biometric-lock-content {
  text-align: center;
  padding: 24px;
}

.biometric-lock-logo {
  margin-bottom: 20px;
}

.biometric-lock-logo svg {
  display: inline-block;
}

.biometric-lock-title {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  margin: 0 0 8px;
}

.biometric-lock-subtitle {
  font-size: 15px;
  color: var(--muted);
  margin: 0 0 24px;
}

.biometric-lock-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
  margin: 0 auto;
}

.biometric-lock-retry-hint {
  font-size: 13px;
  color: var(--muted-dim);
  margin: 0;
}

/* Settings toggle switch */
.settings-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-toggle-info {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.settings-toggle-label {
  font-size: 14px;
  font-weight: 500;
}

.settings-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 12px;
  background: var(--border);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
}

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

.settings-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 0.2s ease;
  pointer-events: none;
}

.settings-toggle.is-on .settings-toggle-thumb {
  transform: translateX(20px);
}

/* Settings form fields */
.settings-field {
  margin-bottom: 10px;
}

.settings-field-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
}

.settings-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

.settings-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(83, 104, 212, 0.15);
}

.settings-input:disabled {
  opacity: 0.6;
}

.settings-select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s ease;
  box-sizing: border-box;
}

.settings-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(83, 104, 212, 0.15);
}

.settings-error {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--danger);
  background: rgba(201, 106, 95, 0.1);
  border: 1px solid rgba(201, 106, 95, 0.2);
}

.settings-success {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ok);
  background: rgba(127, 191, 148, 0.1);
  border: 1px solid rgba(127, 191, 148, 0.2);
}

/* View toggle (List / Grid) */
.view-toggle {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 3px;
}

.view-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  color: var(--muted);
  transition: color 0.15s ease, background-color 0.15s ease;
}

.view-toggle-btn:hover {
  color: var(--text);
}

.view-toggle-btn.is-active {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Grid view */
.note-grid .grid-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.grid-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
  box-shadow: var(--card-shadow);
  min-height: 240px;
  transition:
    border-color 0.2s ease,
    background-color 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.grid-card:hover {
  border-color: var(--accent-soft);
  background: var(--surface);
  transform: translateY(-1px);
  box-shadow: var(--card-shadow-hover);
}

.grid-card:active {
  transform: translateY(0);
  box-shadow: none;
  transition-duration: 0.05s;
}

.grid-card-header {
  min-width: 0;
}

.grid-card-title {
  font-weight: 600;
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.3;
}

.grid-card-snippet {
  font-size: 12.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 9;
  -webkit-box-orient: vertical;
  line-height: 1.35;
  flex: 1;
  white-space: pre-wrap;
  word-break: break-word;
}

.grid-card-footer {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: auto;
}

.grid-card-footer .chip {
  font-size: 10.5px;
  padding: 1px 6px;
}

.grid-card-actions {
  display: flex;
  align-items: center;
  gap: 1px;
  margin-left: auto;
}

.grid-card-actions .icon-btn.subtle {
  width: 22px;
  height: 22px;
}

@media (max-width: 400px) {
  .page.grid-view {
    padding-left: 10px;
    padding-right: 10px;
  }

  .note-grid .grid-items {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

/* Loading skeletons */
.skeleton-label-spacer {
  height: 18px;
  min-height: 18px;
  margin: 24px 0 10px;
  visibility: hidden;
  pointer-events: none;
  font-size: 12px;
  line-height: 1.5;
}

.skeleton-card {
  background: #ffffff;
  pointer-events: none;
  cursor: default;
  animation: none;
  content-visibility: visible;
  contain-intrinsic-size: none;
}

.skeleton-line {
  position: relative;
  overflow: hidden;
  background: #e4e5ed;
  border-radius: 6px;
  flex-shrink: 0;
}

.skeleton-title {
  width: 60%;
  height: 14px;
}

.skeleton-body-90 {
  width: 90%;
  height: 10px;
  margin-top: 8px;
}

.skeleton-body-70 {
  width: 70%;
  height: 10px;
  margin-top: 8px;
}

.skeleton-line::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.5) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: translateX(-100%);
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-line::after {
    animation: none;
    opacity: 0;
  }
}

/* In-place swap: no drop/slide entrance when real cards replace skeleton */
.note-list .list-item,
.note-list .grid-card,
.note-grid .grid-card,
.note-group > .list-item,
.note-group > .grid-items > .grid-card {
  animation: none;
  content-visibility: visible;
  contain-intrinsic-size: none;
  transition:
    border-color 0.2s ease,
    background-color 0.2s ease,
    box-shadow 0.2s ease;
}

.note-list .list-item:hover,
.note-list .due-item:hover,
.note-grid .grid-card:hover {
  transform: none;
}
:root {
  color-scheme: dark;
  --bg: #0D1320;
  --surface: #141C2B;
  --surface-2: #1C2638;
  --border: #253049;
  --text: #E8ECF4;
  --muted: #8896B0;
  --muted-dim: #5A6A85;
  --accent: #6C8CFF;
  --accent-bright: #8AA8FF;
  --accent-soft: #5A7AE8;
  --fab-color: #8B5CF6;
  --fab-color-hover: #A78BFA;
  --favorite: #F59E0B;
  --danger: #EF4444;
  --ok: #34D399;
  --ref: #7DD3FC;
  --nav-bg: #111827;
  --nav-bg-solid: #111827;
  --pill-bg: transparent;
  --pill-text: var(--muted-dim);
  --radius: 12px;
  --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  --card-shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.35);
}

:root[data-theme='dark'] {
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']):not([data-theme='light']) {
    color-scheme: light;
    --bg: #F0F2F7;
    --surface: #FFFFFF;
    --surface-2: #F5F7FB;
    --border: #E2E6F0;
    --text: #1A1F36;
    --muted: #6B7A99;
    --muted-dim: #9CA7C2;
    --accent: #5368D4;
    --accent-bright: #4257B8;
    --accent-soft: #6B7FEA;
    --fab-color: #7C3AED;
    --fab-color-hover: #6D28D9;
    --favorite: #D97706;
    --danger: #DC2626;
    --ok: #059669;
    --ref: #0EA5E9;
    --nav-bg: #FFFFFF;
    --nav-bg-solid: #FFFFFF;
    --pill-bg: transparent;
    --pill-text: var(--muted-dim);
  }
}

:root[data-theme='light'] {
  color-scheme: light;
  --bg: #F0F2F7;
  --surface: #FFFFFF;
  --surface-2: #F5F7FB;
  --border: #E2E6F0;
  --text: #1A1F36;
  --muted: #6B7A99;
  --muted-dim: #9CA7C2;
  --accent: #5368D4;
  --accent-bright: #4257B8;
  --accent-soft: #6B7FEA;
  --fab-color: #7C3AED;
  --fab-color-hover: #6D28D9;
  --favorite: #D97706;
  --danger: #DC2626;
  --ok: #059669;
  --ref: #0EA5E9;
  --nav-bg: #FFFFFF;
  --nav-bg-solid: #FFFFFF;
  --pill-bg: transparent;
  --pill-text: var(--muted-dim);
}
