:root {
  --bg: #0b0f17;
  --bg-accent: radial-gradient(circle at 18% 15%, rgba(99, 102, 241, 0.16), transparent 42%),
               radial-gradient(circle at 82% 85%, rgba(16, 185, 129, 0.12), transparent 42%);
  --surface: #121826;
  --surface-2: #171f31;
  --border: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.28);
  --text: #eef2ff;
  --muted: #94a3b8;
  --primary: #6366f1;
  --primary-hover: #5254e6;
  --ok: #10b981;
  --danger: #ef4444;
  --info: #38bdf8;
  --radius: 14px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

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

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  background-image: var(--bg-accent);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88rem;
}

.muted {
  color: var(--muted);
  margin: 0;
}

/* Auth layout */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-shell {
  width: 100%;
  max-width: 420px;
}

.auth-card {
  background: rgba(18, 24, 38, 0.92);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 32px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.brand-row.compact {
  margin-bottom: 0;
  gap: 10px;
}

.brand-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #10b981);
  flex-shrink: 0;
}

.brand-badge.small {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  font-size: 0.85rem;
}

.brand-badge svg {
  width: 24px;
  height: 24px;
  display: block;
}

.brand-badge.small svg {
  width: 19px;
  height: 19px;
}

.brand-title {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-title.small {
  font-size: 1rem;
  line-height: 1.2;
}

.brand-subtitle {
  margin: 2px 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.brand-subtitle.small {
  font-size: 0.78rem;
  margin-top: 0;
}

/* Form controls */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 0.88rem;
  font-weight: 500;
  color: #cbd5e1;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.22);
}

.field textarea {
  resize: vertical;
}

.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrap input {
  padding-right: 88px;
}

.toggle-pass {
  position: absolute;
  right: 8px;
  padding: 5px 9px;
  border: none;
  border-radius: 7px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--muted);
  font-size: 0.78rem;
  cursor: pointer;
}

.toggle-pass:hover {
  color: var(--text);
  background: rgba(148, 163, 184, 0.22);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 0.94rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
}

.btn-section {
  margin-bottom: 10px;
}

.brand-link {
  color: inherit;
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn-full {
  width: 100%;
  padding: 12px 18px;
}

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

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

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
  padding: 8px 14px;
  font-size: 0.88rem;
}

.btn-ghost:hover {
  background: rgba(148, 163, 184, 0.12);
}

.btn-danger-outline {
  background: transparent;
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.35);
  padding: 8px 14px;
  font-size: 0.86rem;
}

.btn-danger-outline:hover {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.6);
}

/* Alerts */
.alert {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.9rem;
  margin-bottom: 18px;
  border: 1px solid transparent;
}

.alert-error {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fecaca;
}

.alert-success {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: #a7f3d0;
}

.alert-info {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.32);
  color: #bae6fd;
}

.auth-foot {
  margin: 22px 0 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

/* Dashboard layout */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(11, 15, 23, 0.82);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.88rem;
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.7);
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 20px 56px;
}

.page-head {
  margin-bottom: 22px;
}

.page-head h1 {
  margin: 0 0 6px;
  font-size: 1.65rem;
  letter-spacing: -0.02em;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 0.82rem;
  color: var(--muted);
}

.stat-value {
  font-size: 1.15rem;
  font-weight: 700;
}

.stat-meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.card-head {
  margin-bottom: 18px;
}

.card-head h2 {
  margin: 0 0 4px;
  font-size: 1.1rem;
}

.row-between {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.module-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.module-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.module-item.placeholder {
  border-style: dashed;
  opacity: 0.88;
}

.module-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.module-desc {
  font-size: 0.84rem;
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(148, 163, 184, 0.14);
  color: #cbd5e1;
  white-space: nowrap;
}

.badge-ok {
  background: rgba(16, 185, 129, 0.16);
  color: #6ee7b7;
}

.table-wrap {
  overflow-x: auto;
}

.sessions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.sessions-table th,
.sessions-table td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
}

.sessions-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
}

.sessions-table tbody tr:last-child td {
  border-bottom: none;
}

.ua-cell {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

/* Modules & Databases */
.module-link {
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.module-link:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
}

.action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-sm {
  padding: 7px 13px;
  font-size: 0.85rem;
}

.btn-xs {
  padding: 5px 9px;
  font-size: 0.78rem;
  border-radius: 7px;
}

.btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

.section-block {
  margin-bottom: 28px;
}

.section-title {
  margin: 0 0 14px;
  font-size: 1.05rem;
  color: #cbd5e1;
}

.db-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.db-card,
.template-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  padding: 20px;
}

.db-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.db-card-title,
.template-title {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

.db-card-title a {
  color: var(--text);
  text-decoration: none;
}

.db-card-title a:hover {
  color: #a5b4fc;
}

.db-card-desc {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.db-card-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--muted);
}

.db-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.field-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  font-size: 0.76rem;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: #cbd5e1;
}

.empty-card {
  text-align: center;
  padding: 36px 24px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.record-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field-span-2 {
  grid-column: span 2;
}

.builder-section {
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.builder-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.builder-row {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.builder-row-main {
  display: grid;
  grid-template-columns: 1.5fr 1fr auto auto;
  gap: 12px;
  align-items: end;
}

.builder-row-btns {
  display: flex;
  gap: 6px;
  padding-bottom: 2px;
}

.builder-req {
  justify-content: flex-end;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #cbd5e1;
  min-height: 42px;
}

.checkbox-inline input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
  cursor: pointer;
}

.save-template-box {
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.danger-card {
  border-color: rgba(239, 68, 68, 0.32);
}

.search-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.search-form input {
  padding: 7px 12px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.88rem;
  min-width: 220px;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ext-link {
  color: #818cf8;
  word-break: break-all;
}

.pre-wrap {
  white-space: pre-wrap;
  max-width: 320px;
}

/* Encrypted Vault */
.vault-auth-card {
  max-width: 520px;
  margin: 0 auto;
}

.vault-reset-foot {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.link-danger {
  background: none;
  border: none;
  color: #fca5a5;
  font-size: 0.84rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px;
}

.link-danger:hover {
  color: #fecaca;
}

.gen-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mini-select {
  width: auto !important;
  padding: 5px 8px !important;
  font-size: 0.8rem !important;
  border-radius: 7px !important;
}

.mini-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
}

.mini-check input {
  width: 14px !important;
  height: 14px !important;
  accent-color: var(--primary);
}

.vault-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.vault-toolbar input[type="search"] {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.94rem;
  outline: none;
}

.vault-toolbar input[type="search"]:focus {
  border-color: var(--primary);
}

.cat-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cat-pill {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cat-pill:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.cat-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.vault-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.vault-item-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  padding: 20px;
}

.vault-item-title {
  margin: 0 0 2px;
  font-size: 1.05rem;
}

.vault-item-url {
  font-size: 0.8rem;
  display: block;
}

.vault-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vault-field-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.vault-field-label {
  font-size: 0.76rem;
  color: var(--muted);
  min-width: 52px;
}

.vault-field-val {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vault-notes {
  padding: 9px 11px;
  border-radius: 9px;
  background: rgba(148, 163, 184, 0.06);
  border: 1px solid var(--border);
  font-size: 0.84rem;
  color: #cbd5e1;
  max-width: 100%;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%) translateY(18px);
  padding: 10px 18px;
  border-radius: 999px;
  background: #1e293b;
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 60;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Device Bridge */
.bridge-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.progress-bar {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
  overflow: hidden;
  margin-top: 6px;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #6366f1, #10b981);
  transition: width 0.2s ease;
}

.badge-ram {
  background: rgba(56, 189, 248, 0.16);
  color: #7dd3fc;
}

.badge-disk {
  background: rgba(168, 85, 247, 0.18);
  color: #d8b4fe;
}

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 24px 16px;
  border-radius: 12px;
  border: 1.5px dashed var(--border-strong);
  background: var(--surface-2);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone:hover,
.dropzone.drag-over {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
}

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dropzone-title {
  font-weight: 600;
  font-size: 0.94rem;
  word-break: break-word;
}

.dropzone-hint {
  font-size: 0.8rem;
  color: var(--muted);
}

.storage-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.storage-opt {
  position: relative;
  cursor: pointer;
}

.storage-opt input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.storage-opt span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.storage-opt strong {
  font-size: 0.9rem;
}

.storage-opt small {
  font-size: 0.76rem;
  color: var(--muted);
}

.storage-opt input[type="radio"]:checked + span {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.14);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.18);
}

.bridge-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bridge-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 20px;
}

.bridge-item-title {
  margin: 0;
  font-size: 1.02rem;
  word-break: break-word;
}

.bridge-text-box {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow-x: auto;
}

.bridge-pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88rem;
  max-height: 280px;
  overflow-y: auto;
}

.bridge-thumb-wrap {
  max-width: 340px;
}

.bridge-thumb {
  display: block;
  max-width: 100%;
  max-height: 220px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.share-active-box {
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.share-url-input {
  width: 100%;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.82rem;
}

.share-panel {
  padding: 14px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

/* Notes & Checklists */
.notes-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.notes-pills-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.note-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border-top: 3px solid var(--border-strong);
}

.note-color-indigo { border-top-color: #6366f1; }
.note-color-emerald { border-top-color: #10b981; }
.note-color-amber { border-top-color: #f59e0b; }
.note-color-rose { border-top-color: #f43f5e; }
.note-color-sky { border-top-color: #38bdf8; }

.note-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.note-title {
  margin: 0;
  font-size: 1.05rem;
  word-break: break-word;
}

.note-title a {
  color: var(--text);
  text-decoration: none;
}

.note-title a:hover {
  color: #a5b4fc;
}

.badge-pin {
  background: rgba(245, 158, 11, 0.16);
  color: #fcd34d;
}

.note-md-body {
  font-size: 0.9rem;
  color: #dce3f3;
  max-height: 290px;
  overflow-y: auto;
  word-break: break-word;
}

.note-md-body .md-p {
  margin: 0 0 8px;
}

.note-md-body .md-p:last-child {
  margin-bottom: 0;
}

.note-md-body .md-h {
  margin: 8px 0 6px;
  font-size: 0.98rem;
  color: #fff;
}

.note-md-body .md-list {
  margin: 4px 0 8px;
  padding-left: 20px;
}

.note-md-body .md-quote {
  margin: 6px 0;
  padding: 6px 10px;
  border-left: 3px solid var(--primary);
  background: rgba(99, 102, 241, 0.08);
  color: #cbd5e1;
  border-radius: 0 6px 6px 0;
}

.note-md-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.84em;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.note-md-body .md-pre {
  margin: 6px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow-x: auto;
}

.note-md-body .md-pre code {
  padding: 0;
  border: none;
  background: transparent;
}

.checklist-view {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 300px;
  overflow-y: auto;
}

.cl-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--surface-2);
  cursor: pointer;
  font-size: 0.9rem;
  transition: opacity 0.15s ease;
}

.cl-row input[type="checkbox"] {
  margin-top: 3px;
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  accent-color: var(--ok);
  cursor: pointer;
}

.cl-row.done {
  opacity: 0.58;
}

.cl-row.done span {
  text-decoration: line-through;
}

.cl-quick-add {
  display: flex;
  gap: 6px;
}

.cl-quick-add input {
  flex: 1;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.85rem;
  outline: none;
}

.cl-quick-add input:focus {
  border-color: var(--primary);
}

.note-card-foot {
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.md-toolbar {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.cl-add-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.cl-add-bar input {
  flex: 1;
  padding: 10px 13px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.92rem;
}

.cl-editor-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cl-edit-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.cl-edit-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--ok);
  cursor: pointer;
}

.cl-edit-input {
  flex: 1;
  padding: 6px 10px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-size: 0.92rem;
  outline: none;
}

.cl-edit-input:focus {
  border-color: var(--border-strong);
  background: var(--surface);
}

.cl-edit-row.done .cl-edit-input {
  text-decoration: line-through;
  color: var(--muted);
}

.color-picker {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-top: 4px;
}

.color-dot {
  position: relative;
  cursor: pointer;
}

.color-dot input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.color-dot span {
  display: block;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.color-dot input:checked + span {
  border-color: #fff;
  transform: scale(1.14);
}

.color-dot-default span { background: #475569; }
.color-dot-indigo span { background: #6366f1; }
.color-dot-emerald span { background: #10b981; }
.color-dot-amber span { background: #f59e0b; }
.color-dot-rose span { background: #f43f5e; }
.color-dot-sky span { background: #38bdf8; }

/* PWA install banner & Android mobile navigation */
.pwa-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  margin-bottom: 18px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.16), rgba(16, 185, 129, 0.12));
  border: 1px solid rgba(99, 102, 241, 0.35);
}

.mobile-nav {
  display: none;
}

@media (max-width: 820px) {
  .stats-grid,
  .content-grid,
  .form-grid-2,
  .form-grid-3,
  .bridge-stats,
  .record-form-grid,
  .db-grid,
  .template-grid,
  .vault-grid,
  .notes-grid,
  .builder-row-main {
    grid-template-columns: 1fr;
  }

  .field-span-2 {
    grid-column: span 1;
  }

  .auth-card {
    padding: 24px;
  }

  body.has-mobile-nav {
    padding-bottom: calc(74px + env(safe-area-inset-bottom, 0px));
  }

  .topbar-actions a.btn-ghost {
    display: none;
  }

  .user-pill {
    display: none;
  }

  .mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: rgba(11, 15, 23, 0.94);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(14px);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  }

  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 4px;
    border-radius: 10px;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 500;
    transition: color 0.15s ease, background 0.15s ease;
  }

  .mobile-nav-item svg {
    width: 20px;
    height: 20px;
  }

  .mobile-nav-item.active {
    color: #a5b4fc;
    background: rgba(99, 102, 241, 0.14);
  }
}
