/*

 */
:root {
  --bg: #f6f7f9; --surface: #fff; --text: #1f2328; --muted: #656d76;
  --border: #d8dee4; --primary: #2f6feb; --primary-hover: #1f5bd0;
  --danger: #cf222e; --mark: #fff3a3; --radius: 8px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117; --surface: #161b22; --text: #e6edf3; --muted: #8d96a0;
    --border: #30363d; --primary: #388bfd; --primary-hover: #58a6ff;
    --danger: #f85149; --mark: #6e5b00;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
       background: var(--bg); color: var(--text); }
a { color: var(--primary); }
h1 { font-size: 1.6rem; margin: 0 0 .5rem; }
mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }
.muted { color: var(--muted); }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem;
          padding: .6rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar nav { display: flex; align-items: center; gap: .75rem; font-size: .9rem; }
.brand { font-weight: 700; text-decoration: none; color: var(--text); font-size: 1.1rem; }
.container { max-width: 900px; margin: 1.5rem auto; padding: 0 16px; }

.btn { display: inline-block; padding: .45rem .9rem; border-radius: var(--radius); border: 1px solid var(--border);
       background: var(--surface); color: var(--text); text-decoration: none; font: inherit; cursor: pointer; line-height: 1.2; }
.btn:hover { filter: brightness(.96); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); filter: none; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); filter: none; }
.btn-sm { padding: .3rem .65rem; font-size: .85rem; }
.btn-block { width: 100%; }
form.button_to { display: inline; }

.flash { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid; }
.flash ul { margin: 0; padding-left: 1.2rem; }
.flash-notice { background: rgba(46,160,67,.12); border-color: rgba(46,160,67,.4); }
.flash-alert  { background: rgba(207,34,46,.10); border-color: rgba(207,34,46,.4); }

.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin: 0; overflow-wrap: anywhere; }
.actions { display: flex; gap: .5rem; align-items: center; }

.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .75rem; }
.toolbar .search { flex: 1 1 240px; }
input[type=text], input[type=email], input[type=password], input[type=search], select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .45rem .65rem; width: 100%; }
.toolbar select { width: auto; }
textarea { resize: vertical; min-height: 12rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.check { display: inline-flex; align-items: center; gap: .35rem; font-size: .9rem; white-space: nowrap; }
.count { font-size: .85rem; margin: 0 0 .75rem; }

.note-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
.note-card { display: flex; justify-content: space-between; gap: 1rem; background: var(--surface);
             border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; }
.note-card-main { min-width: 0; }
.note-card h2 { font-size: 1.1rem; margin: 0 0 .25rem; overflow-wrap: anywhere; }
.note-card h2 a { color: var(--text); text-decoration: none; }
.note-card h2 a:hover { color: var(--primary); }
.excerpt { margin: 0 0 .35rem; color: var(--muted); overflow-wrap: anywhere; }
.meta { font-size: .8rem; color: var(--muted); margin: 0; }
.note-card-actions { display: flex; gap: .4rem; align-items: flex-start; flex-shrink: 0; }
.empty { text-align: center; padding: 2.5rem 1rem; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }

.note { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.5rem; }
.note-body { margin-top: 1rem; overflow-wrap: anywhere; }
.note-body p { margin: 0 0 .8rem; }

.form .field { margin-bottom: 1rem; }
.form label { display: block; font-weight: 600; margin-bottom: .3rem; }

.auth-body { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border);
             border-radius: 12px; padding: 2rem; }

@media (max-width: 600px) {
  .note-card { flex-direction: column; }
  .toolbar select { flex: 1 1 45%; }
}
