.notes-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 28px 0;
}
.notes-controls .search {
  flex: 1;
}
.notes-controls select {
  width: auto;
  max-width: 220px;
}
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}
.note-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  padding: 24px;
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  transition:
    transform 0.18s,
    border-color 0.18s;
}
.note-card:hover {
  transform: translateY(-2px);
  border-color: var(--brand);
}
.note-card h2 {
  font-size: 20px;
  margin: 20px 0 10px;
  overflow-wrap: anywhere;
}
.note-card p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
}
.note-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}
.note-meta svg {
  width: 16px;
  height: 16px;
}
.note-card time {
  margin-top: auto;
  padding-top: 22px;
  color: var(--muted);
  font-size: 12px;
}
.notes-empty {
  grid-column: 1/-1;
  text-align: center;
  padding: 64px 16px;
}
.notes-empty > svg {
  width: 40px;
  color: var(--muted);
}
.notes-sync {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-top: 24px;
  font-size: 12px;
  color: var(--muted);
}
.note-dialog {
  width: min(760px, calc(100% - 32px));
  max-height: 92dvh;
  padding: 0 !important;
}
.note-dialog > .modal-close {
  display: none;
}
.note-dialog > button[data-action="close"] {
  display: none;
}
#note-form {
  display: flex;
  flex-direction: column;
  height: 80dvh;
  max-height: 850px;
  margin: 0;
}
.note-editor-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  border-bottom: 1px solid var(--line);
}
.note-editor-heading h2 {
  margin: 0;
}
.note-scroll {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding: 24px 28px;
}
.note-title {
  font-size: 28px !important;
  font-weight: 650;
  border: 0 !important;
  padding: 8px 0 !important;
  background: transparent !important;
}
.note-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 20px 0 10px;
}
.note-tools button,
.note-actions button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
}
.note-tools button:last-child {
  margin-left: auto;
}
#note-form textarea {
  min-height: 280px;
  resize: vertical;
  font-size: 16px;
  line-height: 1.75;
  border: 0;
  padding: 12px 0;
  background: transparent;
}
#note-preview {
  min-height: 280px;
  line-height: 1.75;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
#note-preview p {
  margin: 6px 0;
}
#note-preview a {
  color: var(--brand);
  text-decoration: underline;
}
.note-check {
  display: flex !important;
  align-items: flex-start;
  gap: 10px;
}
.note-check input {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 5px;
}
.note-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 24px;
}
.note-save-status {
  padding: 14px 28px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
#note-error {
  color: var(--danger, #d74949);
}
.notes-workspace .topbar .primary {
  display: none;
}
[hidden] {
  display: none !important;
}
@media (max-width: 640px) {
  .notes-controls {
    flex-wrap: wrap;
    gap: 10px;
  }
  .notes-controls .search {
    flex-basis: 100%;
  }
  .notes-controls select {
    flex: 1;
    max-width: 100%;
    min-width: 0;
  }
  .notes-controls button {
    font-size: 12px;
  }
  .notes-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .note-card {
    min-height: 180px;
    padding: 20px;
  }
  .notes-workspace .page-heading {
    align-items: flex-start;
  }
  .notes-workspace .page-heading .primary {
    font-size: 12px;
    padding: 12px;
  }
  .note-dialog {
    width: 100%;
    max-width: none;
    max-height: 94dvh;
    margin: auto 0 0;
    border-radius: 24px 24px 0 0 !important;
  }
  #note-form {
    height: 90dvh;
    max-height: none;
  }
  .note-editor-heading {
    padding: 16px 20px;
  }
  .note-scroll {
    padding: 18px 20px;
  }
  .note-save-status {
    padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  }
  .note-title {
    font-size: 25px !important;
  }
  .note-tools button {
    font-size: 12px;
    padding: 10px;
  }
  .phone-tabs button {
    min-width: 0;
  }
}
#note-form select {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  margin-top: 14px;
}
.note-check input {
  accent-color: var(--brand);
}
html[data-text-size="large"] .note-card p,
html[data-text-size="large"] #note-form textarea {
  font-size: 18px;
}
@media (prefers-reduced-motion: reduce) {
  .note-card {
    transition: none;
  }
}
.notes-controls select {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  padding: 13px 32px 13px 14px;
  font: inherit;
  font-size: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23758091' stroke-width='1.5'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.note-actions .danger {
  color: var(--danger, #b84949);
}
#note-form textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
  color: var(--text);
}
#note-form .note-title {
  width: 100%;
  box-sizing: border-box;
  color: var(--text);
}
