/* ===== Reset & Base Variables ===== */
:root {
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Hiragino Sans", "Meiryo", sans-serif;
  --font-mono: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace;

  /* Light Theme */
  --bg-app: #f7f9fa;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f3f5;
  --bg-card-active: #e8f0fe;
  --bg-input: #ffffff;
  --border-color: #e5e8eb;
  --border-subtle: #f0f2f4;
  --text-main: #1f2328;
  --text-muted: #656d76;
  --text-subtle: #8c959f;
  --primary: #1a73e8;
  --primary-hover: #1557b0;
  --primary-light: #e8f0fe;
  --danger: #d93025;
  --danger-hover: #b3261e;
  --danger-light: #fce8e6;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

body.theme-dark {
  /* Dark Theme */
  --bg-app: #18191a;
  --bg-sidebar: #242526;
  --bg-card: #242526;
  --bg-card-hover: #303031;
  --bg-card-active: #2b394e;
  --bg-input: #3a3b3c;
  --border-color: #393a3b;
  --border-subtle: #2f3031;
  --text-main: #e4e6eb;
  --text-muted: #b0b3b8;
  --text-subtle: #8a8d91;
  --primary: #4799eb;
  --primary-hover: #6cb0f6;
  --primary-light: #1f2f47;
  --danger: #ff5252;
  --danger-hover: #ff7373;
  --danger-light: #3d2020;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
}

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

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Utilities ===== */
.hidden { display: none !important; }
.mobile-only { display: none !important; }
.text-danger { color: var(--danger) !important; }

/* ===== Buttons & Controls ===== */
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: transparent;
  color: inherit;
}

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

.icon-btn:hover {
  background-color: var(--bg-card-hover);
  color: var(--text-main);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

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

.btn-action {
  background-color: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}
.btn-action:hover {
  background-color: var(--primary);
  color: #ffffff;
}

.btn-danger {
  background-color: var(--danger);
  color: #ffffff;
}
.btn-danger:hover {
  background-color: var(--danger-hover);
}

.btn-outline-danger {
  border: 1px solid var(--danger);
  color: var(--danger);
}
.btn-outline-danger:hover {
  background-color: var(--danger-light);
}

.btn-outline-primary {
  border: 1px solid var(--primary);
  color: var(--primary);
}
.btn-outline-primary:hover {
  background-color: var(--primary-light);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-block {
  width: 100%;
}

/* ===== Loading Screen ===== */
.loading-screen {
  position: fixed;
  inset: 0;
  background-color: var(--bg-app);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 1000;
  color: var(--text-muted);
}

.spinner, .btn-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.btn-spinner {
  width: 16px;
  height: 16px;
  border-width: 2px;
  border-top-color: #ffffff;
}

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

/* ===== Login Screen ===== */
.login-screen {
  position: fixed;
  inset: 0;
  background-color: var(--bg-app);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 900;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}

.brand-icon {
  width: 52px;
  height: 52px;
  color: var(--primary);
  margin-bottom: 12px;
}

.login-brand h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.brand-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.login-form .form-group {
  margin-bottom: 18px;
}

.login-form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
}

.login-form input {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.login-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.alert-error {
  background-color: var(--danger-light);
  color: var(--danger);
  border: 1px solid var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 18px;
}

.login-hint {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 18px;
  line-height: 1.5;
}

/* ===== App Layout ===== */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
}

/* Top Global Header */
.app-header {
  height: 52px;
  background-color: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 16px;
  flex-shrink: 0;
  z-index: 10;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text-main);
  user-select: none;
}
.app-title svg {
  color: var(--primary);
}

.header-search {
  flex: 1;
  min-width: 0;
  max-width: 480px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-box .search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-subtle);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 7px 32px 7px 36px;
  font-size: 13px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-app);
  color: var(--text-main);
  outline: none;
  transition: all 0.15s ease;
}

.search-box input:focus {
  background-color: var(--bg-input);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.clear-search-btn {
  position: absolute;
  right: 10px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: var(--text-subtle);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-divider {
  width: 1px;
  height: 22px;
  background-color: var(--border-color);
  margin: 0 4px;
}

.user-menu-container {
  position: relative;
}

.user-profile-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
}
.user-profile-btn:hover {
  background-color: var(--bg-card-hover);
}

.user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 200px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 8px 0;
  z-index: 100;
}

.dropdown-header {
  padding: 8px 16px;
}
.dropdown-header strong {
  display: block;
  font-size: 14px;
}
.dropdown-header small {
  color: var(--text-muted);
}

.dropdown-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 6px 0;
}

.dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 13px;
  text-align: left;
}
.dropdown-item:hover {
  background-color: var(--bg-card-hover);
}

/* ===== Main Workspace Layout ===== */
.app-workspace {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
  position: relative;
}

.nav-backdrop {
  display: none;
}

/* 1. Navigation Sidebar (Folders & Tags) */
.nav-sidebar {
  width: 220px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
  transition: width 0.2s ease, transform 0.2s ease;
}

.nav-sidebar.collapsed {
  width: 0;
  transform: translateX(-100%);
  border-right: none;
}

.nav-section {
  padding: 12px 10px;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-subtle);
  padding: 4px 10px;
  letter-spacing: 0.5px;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-align: left;
  transition: all 0.12s;
  margin-top: 2px;
}

.nav-item:hover {
  background-color: var(--bg-card-hover);
  color: var(--text-main);
}

.nav-item.active {
  background-color: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.nav-item .badge {
  margin-left: auto;
  font-size: 11px;
  background-color: var(--border-color);
  color: var(--text-muted);
  padding: 1px 6px;
  border-radius: 10px;
}

.nav-item.active .badge {
  background-color: var(--primary);
  color: #fff;
}

.tags-list {
  padding: 4px 0;
}

.tag-nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}
.tag-nav-item:hover {
  background-color: var(--bg-card-hover);
  color: var(--text-main);
}
.tag-nav-item.active {
  background-color: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.no-tags {
  display: block;
  font-size: 12px;
  color: var(--text-subtle);
  padding: 6px 10px;
}

/* 2. Note List Section */
.note-list-section {
  width: 310px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.note-list-header {
  height: 44px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

.note-list {
  flex: 1;
  overflow-y: auto;
  outline: none;
}

.note-card {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background-color 0.12s;
  position: relative;
}

.note-card:hover {
  background-color: var(--bg-card-hover);
}

.note-card.active {
  background-color: var(--bg-card-active);
  border-left: 3px solid var(--primary);
  padding-left: 13px;
}

.note-card-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.note-card-pin {
  color: var(--primary);
  flex-shrink: 0;
}

.note-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.note-card-preview {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  height: 34px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
  word-break: break-all;
}

.note-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-subtle);
}

.note-card-tags {
  display: flex;
  gap: 4px;
  overflow: hidden;
}

.note-card-tag {
  background-color: var(--border-color);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  white-space: nowrap;
}

.empty-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-subtle);
  padding: 24px;
  text-align: center;
}

/* 3. Editor Section */
.editor-section {
  flex: 1;
  min-width: 0;
  background-color: var(--bg-app);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.editor-toolbar {
  height: 48px;
  padding: 0 20px;
  background-color: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.save-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-subtle);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #34a853; /* Saved green */
  transition: background-color 0.2s;
}

.save-status.saving .status-dot {
  background-color: #fbbc04; /* Saving yellow */
}
.save-status.saving .status-text {
  color: var(--text-muted);
}

.editor-trash-bar {
  display: flex;
  gap: 6px;
  margin-right: 10px;
}

/* Info Popover */
.info-panel {
  position: absolute;
  top: 56px;
  right: 20px;
  width: 220px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 12px 14px;
  z-index: 50;
  font-size: 12px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.info-row span {
  color: var(--text-muted);
}

.info-row strong, .info-row small {
  color: var(--text-main);
}

.info-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 8px 0;
}

/* Editor Body */
.editor-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
  display: flex;
}

.note-textarea {
  width: 100%;
  height: 100%;
  padding: 28px 32px;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 1.7;
  resize: none;
  outline: none;
  overflow-y: auto;
}

.note-textarea::placeholder {
  color: var(--text-subtle);
}

.note-preview {
  width: 100%;
  height: 100%;
  padding: 28px 32px;
  overflow-y: auto;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

/* Markdown typography */
.markdown-body h1 { font-size: 24px; margin: 16px 0 8px; border-bottom: 1px solid var(--border-color); padding-bottom: 6px; }
.markdown-body h2 { font-size: 20px; margin: 14px 0 8px; border-bottom: 1px solid var(--border-subtle); padding-bottom: 4px; }
.markdown-body h3 { font-size: 17px; margin: 12px 0 6px; }
.markdown-body p { margin-bottom: 12px; }
.markdown-body ul, .markdown-body ol { margin: 8px 0 12px 24px; }
.markdown-body li { margin-bottom: 4px; }
.markdown-body pre { background-color: var(--bg-card-hover); padding: 12px; border-radius: var(--radius-sm); overflow-x: auto; margin-bottom: 12px; }
.markdown-body code { font-family: var(--font-mono); font-size: 13px; background-color: var(--bg-card-hover); padding: 2px 4px; border-radius: 3px; }
.markdown-body pre code { background: none; padding: 0; }
.markdown-body blockquote { border-left: 4px solid var(--primary); padding-left: 12px; color: var(--text-muted); margin-bottom: 12px; }
.markdown-body a { color: var(--primary); text-decoration: underline; }
.markdown-body hr { border: none; height: 1px; background-color: var(--border-color); margin: 20px 0; }

/* Tags Bar */
.editor-tags-bar {
  height: 44px;
  flex-shrink: 0;
  background-color: var(--bg-sidebar);
  border-top: 1px solid var(--border-color);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
}

.note-tags-list {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background-color: var(--bg-card-hover);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
}

.tag-pill-remove {
  font-size: 14px;
  line-height: 1;
  color: var(--text-subtle);
  cursor: pointer;
}
.tag-pill-remove:hover {
  color: var(--danger);
}

.tag-input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: var(--text-main);
  flex: 1;
  min-width: 120px;
}
.tag-input::placeholder {
  color: var(--text-subtle);
}

/* No Note Selected Placeholder */
.no-note-selected-section {
  flex: 1;
  background-color: var(--bg-app);
  display: flex;
  align-items: center;
  justify-content: center;
}

.placeholder-content {
  text-align: center;
  max-width: 360px;
  padding: 24px;
  color: var(--text-muted);
}

.placeholder-content svg {
  color: var(--text-subtle);
  margin-bottom: 16px;
}

.placeholder-content h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 8px;
}

.placeholder-content p {
  font-size: 13px;
  margin-bottom: 20px;
  line-height: 1.5;
}

/* ===== Responsive Styles (Mobile & Tablet) ===== */
@media (max-width: 1023px) {
  .mobile-only {
    display: inline-flex !important;
  }

  .btn-label {
    display: none;
  }

  .app-header {
    height: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "brand actions" "search search";
    gap: 6px 8px;
    padding: calc(6px + env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 8px max(8px, env(safe-area-inset-left));
  }

  .header-left { grid-area: brand; gap: 8px; }
  .header-search { grid-area: search; max-width: none; }
  .header-actions { grid-area: actions; gap: 4px; }

  .app-container .icon-btn,
  #newNoteBtn,
  .user-profile-btn {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    padding: 0;
  }

  .user-profile-btn { justify-content: center; }
  .user-profile-btn .user-name,
  .user-profile-btn > svg:not(.mobile-only),
  .header-divider,
  #installPwaBtn { display: none; }

  .search-box input {
    height: 44px;
    font-size: 16px;
    padding-right: 48px;
  }

  .clear-search-btn { width: 32px; height: 32px; right: 6px; }

  .nav-sidebar,
  .nav-sidebar.collapsed {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(280px, calc(100% - 48px));
    z-index: 40;
    box-shadow: var(--shadow-lg);
    border-right: 1px solid var(--border-color);
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.2s ease, visibility 0.2s;
    padding-bottom: env(safe-area-inset-bottom);
  }

  body.nav-open .nav-sidebar {
    transform: translateX(0);
    visibility: visible;
  }

  body.nav-open .nav-backdrop {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 35;
    background: rgba(0, 0, 0, 0.35);
  }

  .nav-item, .tag-nav-item {
    min-height: 44px;
    font-size: 14px;
  }

  .tag-nav-item { gap: 8px; overflow-wrap: anywhere; }

  .note-list-header { min-height: 48px; height: auto; gap: 8px; }

  .note-list {
    padding-bottom: env(safe-area-inset-bottom);
    overscroll-behavior: contain;
  }

  .note-list-section {
    width: 100%;
    min-width: 0;
    border-right: none;
  }

  body.editor-open .note-list-section { visibility: hidden; }

  .editor-section {
    position: absolute;
    inset: 0;
    z-index: 30;
    background-color: var(--bg-app);
    transform: translateX(100%);
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.2s ease, visibility 0.2s;
  }

  body.editor-open .editor-section {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }

  .no-note-selected-section {
    display: none !important;
  }

  .note-textarea, .note-preview {
    padding: 16px max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left));
  }

  .editor-toolbar {
    height: auto;
    min-height: 52px;
    padding: 4px 8px;
    gap: 0 8px;
    flex-wrap: wrap;
  }

  .toolbar-left { flex: 1; }
  .toolbar-right { max-width: 100%; gap: 0; flex-wrap: wrap; justify-content: flex-end; }
  .editor-trash-bar { flex-basis: 100%; justify-content: flex-end; margin: 0; gap: 8px; }
  .editor-trash-bar .btn { min-height: 44px; }

  .editor-tags-bar {
    height: auto;
    min-height: 48px;
    padding: 6px max(12px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }

  .tag-input { font-size: 16px; min-width: 80px; }
  .tag-pill { flex-shrink: 0; }
  .info-panel { right: 8px; max-width: calc(100% - 16px); }
  .login-form input { font-size: 16px; }
}

@media (min-width: 600px) and (max-width: 1023px) and (max-height: 500px) {
  .app-header {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "brand search actions";
  }
}

@media (max-width: 360px) {
  .save-status .status-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
}

/* ===== PWA Install Modal ===== */
.pwa-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.pwa-modal-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

.pwa-modal-content {
  position: relative;
  width: 100%;
  max-width: 460px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  max-height: 90vh;
  overflow-y: auto;
}

.pwa-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.pwa-modal-header h3 {
  font-size: 17px;
  font-weight: 700;
}

.pwa-modal-body p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 16px;
}

.install-instructions {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.instruction-platform {
  background-color: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 13px;
}
.instruction-platform strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text-main);
}
.instruction-platform ol {
  padding-left: 20px;
  color: var(--text-muted);
  line-height: 1.6;
}
.instruction-platform li {
  margin-bottom: 2px;
}
