:root {
  color-scheme: light;
  font-family: system-ui, sans-serif;
  color: #172033;
  background: #f5f7fb;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
  background: #2057c8;
  border: 0;
  border-radius: 8px;
  color: white;
  padding: 0.65rem 1rem;
  font-weight: 600;
}

button:disabled {
  cursor: default;
  opacity: 0.5;
}

.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.page-header,
.brand,
.toolbar,
.actions,
.pagination,
.note-header,
.dialog-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.page-header,
.note-header,
.dialog-header {
  justify-content: space-between;
}

.brand h1 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: -0.04em;
}

.panel,
.note {
  background: white;
  border: 1px solid #e3e8f2;
  border-radius: 12px;
  padding: 1.25rem;
  margin: 1rem 0;
  box-shadow: 0 3px 14px #19365b0b;
}

dialog h2 {
  margin: 0;
  overflow-wrap: anywhere;
}

.panel h2 {
  margin-top: 0;
}

.auth {
  max-width: 460px;
  margin-inline: auto;
}

.auth-switch {
  margin-top: 1rem;
  padding: 0;
  color: #2057c8;
  background: none;
  text-decoration: underline;
}

form {
  display: grid;
  gap: 0.8rem;
}

label {
  display: grid;
  gap: 0.3rem;
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #a8b4c8;
  border-radius: 8px;
  padding: 0.65rem 0.7rem;
  background: white;
  color: inherit;
}

textarea {
  min-height: 8rem;
  resize: vertical;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid #93b4f6;
  outline-offset: 2px;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 400;
}

.check-label input {
  width: auto;
}

.toolbar {
  flex-wrap: wrap;
  margin: 1.25rem 0;
}

.toolbar > * {
  height: 2.75rem;
}

.toolbar #search-input {
  flex: 1;
  min-width: 10rem;
}

.toolbar select {
  width: 11rem;
}

.favorite-filter {
  width: 2.75rem;
  padding: 0;
  font-size: 1.6rem;
  line-height: 1;
}

.favorite-filter[aria-pressed="true"] {
  color: #a15b00;
  background: #fff0c2;
}

.secondary {
  color: #203354;
  background: #e9eef8;
}

.notes-list {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
}

.note {
  margin: 0;
}

.note h3 {
  margin: 0;
  font-size: 1.15rem;
}

.note p {
  margin: 0.75rem 0;
  color: #455269;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.note-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.note-buttons button {
  padding: 0.45rem 0.65rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  background: #e4edff;
  color: #1d4a9b;
}

.tag button {
  padding: 0 0.1rem;
  background: none;
  color: inherit;
  font-size: 1.1rem;
  line-height: 1;
}

button:hover:not(:disabled) {
  filter: brightness(0.94);
}

.tag-adder {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.8rem;
}

.tag-adder input {
  max-width: 180px;
}

.muted {
  color: #59677d;
}

.status {
  margin: 0.75rem 0;
  color: #9d2437;
}

.pagination {
  justify-content: center;
  margin: 1.5rem 0;
}

dialog {
  width: min(90vw, 580px);
  border: 1px solid #d5ddeb;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 20px 60px #14203d55;
}

dialog::backdrop {
  background: #14203d88;
}

#dialog-content {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (width <= 680px) {
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar select {
    width: 100%;
  }

  .note-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .container {
    padding: 1.25rem 0.8rem 3rem;
  }
}
