/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   SimpleNote — Style (ColorNote dark)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

:root {
  --bg:          #1a1a1a;
  --surface:     #242424;
  --surface2:    #2e2e2e;
  --border:      #383838;
  --text:        #f0f0f0;
  --text-muted:  #888;
  --accent:      #ffca28;
  --danger:      #e53935;
  --radius:      12px;
  --font:        'Inter', sans-serif;
  --shadow:      0 4px 20px rgba(0,0,0,.4);
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Auth ── */
.auth-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: linear-gradient(135deg, #1a1a1a 0%, #111 100%);
}

.auth-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo .logo-icon {
  font-size: 52px;
  display: block;
  margin-bottom: 8px;
}

.auth-logo h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.auth-logo p {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

.auth-tabs {
  display: flex;
  background: var(--surface2);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 28px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: none;
  color: var(--text-muted);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
}

.auth-tab.active {
  background: var(--accent);
  color: #111;
  font-weight: 700;
}

.field {
  margin-bottom: 16px;
}

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

.field input {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  outline: none;
  transition: border-color .2s;
}

.field input:focus {
  border-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}

.btn-primary {
  background: var(--accent);
  color: #111;
  width: 100%;
  margin-top: 8px;
  font-size: 16px;
  padding: 14px;
}

.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:active { transform: scale(.98); }

.btn-ghost {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover { background: var(--border); }

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

.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  font-size: 20px;
  display: inline-flex;
  align-items: center;
  transition: all .15s;
}

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

.error-msg {
  background: rgba(229,57,53,.15);
  border: 1px solid rgba(229,57,53,.4);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  color: #ef9a9a;
  margin-top: 12px;
  display: none;
}

/* ── Main App ── */
#app { display: flex; flex-direction: column; min-height: 100vh; }

.top-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: max(env(safe-area-inset-top, 0px), 0px) 16px 0;
  min-height: calc(60px + env(safe-area-inset-top, 0px));
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.top-bar-logo {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-bar-logo span { font-size: 26px; }

.search-wrap {
  flex: 1;
  max-width: 340px;
  position: relative;
}

.search-wrap input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 36px 8px 14px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
}

.search-wrap input:focus { border-color: var(--accent); }

.search-wrap .search-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
}

/* ── Notes Grid ── */
.notes-area {
  padding: 20px 16px;
  flex: 1;
}

.section-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0 0 12px 4px;
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
}

.note-card {
  border-radius: var(--radius);
  padding: 14px 12px;
  cursor: pointer;
  position: relative;
  min-height: 110px;
  transition: transform .15s, box-shadow .15s;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.note-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}

.note-card:active { transform: scale(.98); }

@keyframes micPulse {
  0% { transform: scale(0.95); opacity: 0.8; box-shadow: 0 0 0 0 rgba(233, 30, 99, 0.7); }
  70% { transform: scale(1.15); opacity: 1; box-shadow: 0 0 0 8px rgba(233, 30, 99, 0); }
  100% { transform: scale(0.95); opacity: 0.8; box-shadow: 0 0 0 0 rgba(233, 30, 99, 0); }
}

.mic-pulse-dot {
  animation: micPulse 1.4s infinite;
}

.voice-mic-btn.recording {
  background: #e91e63 !important;
  color: #fff !important;
  border-color: #e91e63 !important;
  animation: micPulse 1.4s infinite;
}

.note-card .note-type-badge {
  font-size: 14px;
  margin-bottom: 6px;
}

.note-card .note-title {
  font-size: 14px;
  font-weight: 600;
  color: rgba(0,0,0,.85);
  line-height: 1.3;
  margin-bottom: 6px;
  word-break: break-word;
}

.note-card .note-preview {
  font-size: 12px;
  color: rgba(0,0,0,.6);
  line-height: 1.5;
  flex: 1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}

.note-card .note-date {
  font-size: 11px;
  color: rgba(0,0,0,.45);
  margin-top: 8px;
}

.notes-list .note-card {
  min-height: auto;
  padding: 10px 14px;
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.notes-list .note-title {
  margin-bottom: 0;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notes-list .note-preview {
  display: none;
}

.notes-list .note-date {
  margin-top: 0;
  position: static;
  white-space: nowrap;
}

.note-card .pin-icon {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 14px;
  opacity: .7;
}

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

.empty-state .empty-icon { font-size: 64px; display: block; margin-bottom: 16px; }
.empty-state p { font-size: 16px; }

/* ── FAB ── */
.fab {
  position: fixed;
  bottom: 28px;
  right: 24px;
  background: var(--accent);
  color: #111;
  border: none;
  border-radius: 50%;
  width: 58px;
  height: 58px;
  font-size: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(255,202,40,.35);
  transition: all .2s;
  z-index: 200;
}

.fab:hover { transform: scale(1.08); }
.fab:active { transform: scale(.95); }

/* ── Modal ── */
/* ── Modal & Overlay Defaults ── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: 18px;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  margin: auto;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  flex: 1;
}

.modal-body {
  padding: 18px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.modal-footer {
  padding: 12px 18px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Full-Screen Note Editor ── */
#editor-overlay {
  padding: 0 !important;
  background: var(--bg) !important;
  backdrop-filter: none !important;
}

#editor-modal {
  background: var(--bg) !important;
  border-radius: 0 !important;
  width: 100% !important;
  height: 100vh !important;
  max-width: 100% !important;
  max-height: 100vh !important;
  margin: 0 !important;
  border: none !important;
}

.editor-top-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: max(env(safe-area-inset-top, 0px), 6px) 12px 6px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  min-height: 52px;
  flex-shrink: 0;
}

.editor-title-static {
  flex: 1;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 4px 0;
}

.note-editor-title {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 18px;
  font-weight: 700;
  outline: none;
  padding: 4px 0;
  margin: 0;
}

.editor-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.editor-main-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px;
  overflow-y: auto;
  position: relative;
}

.note-editor-content {
  width: 100%;
  flex: 1;
  min-height: 250px;
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  outline: none;
  resize: none;
}

/* ── Rich Text Editor Toolbar & Content ── */
.rte-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 6px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-top: 8px;
  margin-bottom: 4px;
  flex-shrink: 0;
  z-index: 10;
}

.rte-select {
  padding: 4px 6px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.rte-btn-group {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.rte-btn {
  padding: 4px 8px;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  border-right: 1px solid var(--border);
  transition: background 0.15s;
}

.rte-btn:hover, .rte-btn:active {
  background: var(--surface2);
}

.rte-btn.active {
  background: var(--accent, #ffeb3b) !important;
  color: #111 !important;
}

.note-editor-content-rich {
  width: 100%;
  flex: 1;
  min-height: 250px;
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  outline: none;
  overflow-y: auto;
  padding: 4px 0;
  overflow-wrap: anywhere;
}

.note-editor-content-rich.lined-paper {
  line-height: 1.5em;
}

.note-editor-content-rich.lined-paper p,
.note-editor-content-rich.lined-paper li,
.note-editor-content-rich.lined-paper h1,
.note-editor-content-rich.lined-paper h2,
.note-editor-content-rich.lined-paper h3,
.note-editor-content-rich.lined-paper div {
  line-height: 1.5em;
  background-image: linear-gradient(to bottom, transparent calc(1.5em - 1px), rgba(160, 160, 160, 0.28) 1.5em);
  background-size: 100% 1.5em;
  background-repeat: repeat-y;
  margin: 0 0 4px 0;
}

.note-editor-content-rich:empty:before {
  content: attr(placeholder);
  color: var(--text-muted);
  pointer-events: none;
  display: block;
}

.note-editor-content-rich ul, .note-editor-content-rich ol {
  padding-left: 24px;
  margin: 6px 0;
}

.note-editor-content-rich p {
  margin: 0 0 6px 0;
}

/* ── 3-Dots Dropdown Menu ── */
.more-menu-dropdown {
  position: absolute;
  top: 40px;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.55);
  min-width: 170px;
  z-index: 500;
  overflow: hidden;
  padding: 6px 0;
}

.more-menu-item {
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}

.more-menu-item:hover, .more-menu-item:active {
  background: var(--surface2);
}

.more-menu-item.danger {
  color: var(--danger, #ff5252);
}

.more-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ── Checklist ── */
.checklist-items { list-style: none; }

.checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.checklist-item:last-child { border-bottom: none; }

.checklist-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.checklist-item .item-text {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  outline: none;
}

.checklist-item .item-text.checked {
  text-decoration: line-through;
  color: var(--text-muted);
}

.del-item {
  color: var(--danger, #ff5252);
  background: rgba(255, 82, 82, 0.12);
  border: 1px solid rgba(255, 82, 82, 0.25);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s, transform .1s;
}

.del-item:hover, .del-item:active {
  background: rgba(255, 82, 82, 0.3);
  color: #ffffff;
}

.add-item-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 14px;
  padding: 10px 0;
  transition: color .15s;
}

.add-item-btn:hover { color: var(--accent); }

/* ── Color Picker ── */
.color-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0 4px;
}

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

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

/* ── Type Toggle ── */
.type-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.type-btn {
  padding: 7px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}

.type-btn.active {
  background: var(--accent);
  color: #111;
  border-color: var(--accent);
  font-weight: 700;
}

/* ── Categorized Checklist Styles ── */
.cat-tab-btn {
  padding: 6px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.cat-tab-btn:hover { background: var(--surface); color: var(--text); }
.cat-tab-btn.active {
  background: var(--accent);
  color: #111;
  border-color: var(--accent);
  font-weight: 700;
}
.cat-tab-btn .cat-badge {
  background: rgba(0,0,0,0.25);
  color: inherit;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}
.cat-tab-btn.active .cat-badge {
  background: rgba(0,0,0,0.15);
}
.cat-tab-btn.add-cat-tab {
  border-style: dashed;
  color: var(--accent);
}

/* ── Share modal ── */
.share-link-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  word-break: break-all;
  color: var(--text-muted);
  margin: 12px 0;
}

.qr-wrap { text-align: center; margin: 12px 0; }
.qr-wrap img { border-radius: 10px; }

/* ── Menu ── */
.user-menu-wrap { position: relative; }

.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  min-width: 180px;
  box-shadow: var(--shadow);
  z-index: 999;
  overflow: hidden;
  display: none;
}

.user-menu.open { display: block; }

.user-menu a, .user-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-family: var(--font);
  background: none;
  border: none;
  width: 100%;
  cursor: pointer;
  transition: background .12s;
}

.user-menu a:hover, .user-menu button:hover { background: var(--surface2); }
.user-menu .danger { color: #ef9a9a; }

/* ── Shared view ── */
.shared-wrap {
  max-width: 600px;
  margin: 40px auto;
  padding: 0 16px;
}

.shared-card {
  border-radius: 18px;
  padding: 28px;
  box-shadow: var(--shadow);
}

/* ── Toast ── */
.toast-container {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.toast {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  box-shadow: var(--shadow);
  animation: toastIn .25s ease;
  white-space: nowrap;
}

.toast.success { background: #1b5e20; border-color: #2e7d32; }
.toast.error   { background: #b71c1c; border-color: #c62828; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .notes-grid { grid-template-columns: repeat(2, 1fr); }
  .search-wrap { max-width: 160px; }
  .auth-card { padding: 28px 20px; }
}

@media (max-width: 380px) {
  .notes-grid { grid-template-columns: 1fr; }
}

/* ── Fingerprint toggle switch ── */
.fp-slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background: white;
  border-radius: 50%;
  transition: .3s;
}
#fingerprint-toggle:checked + .fp-slider { background: var(--accent, #ffca28); }
#fingerprint-toggle:checked + .fp-slider::before { transform: translateX(24px); }

/* ── Quick-delete button on note cards ─────────────────────── */
.note-del-btn {
  position: absolute;
  top: 7px;
  right: 7px;
  background: rgba(0,0,0,0.55);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 15px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
  z-index: 2;
  line-height: 1;
}
.note-card:hover .note-del-btn {
  opacity: 1;
}
.note-del-btn:hover {
  background: rgba(211,47,47,0.85);
}
@media (hover: none) {
  .note-del-btn { opacity: 1; }
}

/* ── Checklist Drag & Drop & Mode Styling ───────────────────── */
.checklist-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: background 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.checklist-item-row.view-mode-row {
  background: transparent;
  border-color: transparent;
  padding: 8px 6px;
  cursor: pointer;
}
.checklist-item-row.view-mode-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.checklist-item-row.draggable-row {
  cursor: grab;
}

.checklist-item-row.dragging {
  opacity: 0.35;
  border: 1px dashed var(--accent) !important;
  background: var(--surface) !important;
}

.checklist-item-row.drag-over {
  border: 2px solid var(--accent) !important;
  background: rgba(255, 202, 40, 0.18) !important;
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.drag-handle {
  cursor: grab;
  user-select: none;
  font-size: 16px;
  color: var(--text-muted);
  padding: 4px 6px;
  touch-action: none;
  opacity: 0.7;
}
.drag-handle:hover {
  opacity: 1.0;
  color: var(--accent);
}
.drag-handle:active {
  cursor: grabbing;
}

/* ── Sort & Filter Bar ── */
.sort-bar-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px 14px 16px;
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 12px;
}
.sort-select-input {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s ease;
}
.sort-select-input:focus, .sort-select-input:hover {
  border-color: var(--accent);
}

/* ── Attachments UI ── */
.attachments-section-container {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.attachments-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.attachments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}
.attachment-chip {
  position: relative;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.attachment-chip:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.attachment-img-preview {
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 6px;
}
.attachment-file-icon {
  width: 100%;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  margin-bottom: 6px;
}
.attachment-name {
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  text-align: center;
}
.attachment-remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: #ff5252;
  border: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  line-height: 1;
  transition: background 0.15s ease;
}
.attachment-remove-btn:hover {
  background: #ff5252;
  color: #fff;
}

/* Note Card Attachments Preview */
.card-attachments-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.card-attach-img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.card-attach-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 3px 8px;
  font-size: 11px;
  color: var(--text-muted);
}
