:root {
  color-scheme: dark;
  --red: #d51c3d;
  --red-dark: #9c0c20;
  --ink: #0d141a;
  --slate: #37444f;
  --steel: #475867;
  --blue: #63788d;
  --mist: #91abbc;
  --white: #f4f7f9;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--ink);
  color: var(--white);
}
* { box-sizing: border-box; }
body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 50% -12%, #63788d99 0, transparent 38%),
    radial-gradient(circle at 50% 112%, #9c0c2050 0, transparent 30%),
    linear-gradient(145deg, var(--ink) 0%, var(--slate) 55%, var(--ink) 100%);
  background-attachment: fixed;
}
.shell { width: min(820px, 100%); margin: 0 auto; padding: 28px 18px 64px; }
.card { background: rgba(13, 20, 26, .88); border: 1px solid #91abbc38; border-radius: 24px; padding: 24px; margin: 18px 0; box-shadow: 0 18px 45px #0d141a80; backdrop-filter: blur(14px); }
.narrow { max-width: 440px; margin: 12vh auto; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 4px; letter-spacing: -.04em; }
h2 { margin-bottom: 4px; font-size: 1.18rem; }
h3 { margin: 0; font-size: 1rem; }
.muted { color: var(--mist); }
.eyebrow { margin-bottom: 5px; color: var(--mist); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.brand-mark { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 18px; border-radius: 16px; background: var(--red); color: white; font-size: 1.6rem; box-shadow: 0 9px 22px #9c0c205e; }
.brand-mark.small { width: 40px; height: 40px; margin: 0; border-radius: 12px; font-size: 1.2rem; }
label { display: block; margin: 14px 0 6px; font-weight: 600; }
input, textarea, button { width: 100%; border: 1px solid #91abbc4d; border-radius: 12px; padding: 12px 13px; color: var(--white); font: inherit; }
input, textarea { background: #37444fcc; }
input::placeholder, textarea::placeholder { color: #91abbcaa; }
input:focus, textarea:focus { border-color: var(--red); box-shadow: 0 0 0 4px #d51c3d29; outline: none; }
textarea { resize: vertical; }
button { margin-top: 16px; border: 0; background: var(--red); color: white; font-weight: 700; cursor: pointer; transition: transform .15s, background .15s, box-shadow .15s; }
button:hover { background: #e62a49; box-shadow: 0 8px 18px #9c0c205c; transform: translateY(-1px); }
button.secondary { background: var(--steel); color: var(--white); }
button.secondary:hover { background: var(--blue); }
.topbar, .row, .search-row, .note-footer, .section-heading, .brand, .header-actions, .calendar-actions { display: flex; gap: 10px; align-items: center; }
.topbar { justify-content: space-between; }
.topbar button { width: auto; margin: 0; }
.row button { flex: 1; }
.search-row input { flex: 1; }
.header-actions { gap: 12px; }
.note-actions { display: flex; gap: 7px; align-items: center; }
.stat-pill, .shortcut-hint { padding: 8px 11px; border: 1px solid #91abbc38; border-radius: 999px; background: #37444f; color: var(--mist); font-size: .8rem; font-weight: 700; }
.section-heading { justify-content: space-between; margin-bottom: 18px; }
.section-heading.compact { margin-bottom: 12px; }
.text-button, .icon-button { width: auto; margin: 0; padding: 8px 10px; background: transparent; color: var(--mist); box-shadow: none; }
.text-button:hover, .icon-button:hover { background: var(--red-dark); box-shadow: none; }
.icon-button { width: 36px; height: 36px; padding: 0; border-radius: 10px; font-size: 1.4rem; line-height: 1; }
.weekday-row, .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.weekday-row { padding: 0 3px 8px; color: var(--mist); font-size: .7rem; font-weight: 800; text-align: center; text-transform: uppercase; }
.calendar-day, .calendar-blank { min-height: 52px; margin: 0; padding: 7px 4px; border-radius: 13px; }
.calendar-day { display: flex; flex-direction: column; align-items: center; justify-content: space-between; border: 1px solid transparent; background: #475867b8; color: var(--white); box-shadow: none; font-size: .9rem; }
.calendar-day:hover { background: var(--blue); box-shadow: none; transform: none; }
.calendar-day.selected { background: var(--red); color: white; }
.calendar-day.today { border-color: var(--red); }
.day-number { line-height: 1; }
.day-count { display: grid; place-items: center; min-width: 18px; height: 18px; border-radius: 999px; background: var(--mist); color: var(--ink); font-size: .68rem; font-weight: 800; }
.calendar-day.selected .day-count { background: white; color: var(--red-dark); }
.selected-day { margin-top: 18px; padding-top: 17px; border-top: 1px solid #91abbc38; }
.calendar-notes .note { padding: 12px 0; }
.calendar-notes .note-footer { margin-top: 8px; }
.refresh-button { width: auto; margin: 0; padding: 9px 13px; }
.note { padding: 18px 0; border-top: 1px solid #91abbc38; }
.note:first-child { border-top: 0; }
.note p { white-space: pre-wrap; overflow-wrap: anywhere; }
.note a { color: var(--mist); overflow-wrap: anywhere; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 13px; }
.tag-chip { width: auto; margin: 0; padding: 5px 9px; border: 0; border-radius: 999px; background: var(--red-dark); color: var(--white); font-size: .78rem; font-weight: 700; box-shadow: none; }
.tag-chip:hover { background: var(--red); box-shadow: none; transform: none; }
.note-footer { margin-top: 14px; }
.note-footer { flex-wrap: wrap; }
.note-footer small { flex: 1; color: var(--mist); }
.link-button { width: auto; margin: 0; padding: 0; background: transparent; color: var(--mist); font-size: .9rem; }
.link-button:hover { background: transparent; color: white; box-shadow: none; transform: none; }
.link-button.danger { color: #f06b7f; }
.error { margin-top: 12px; color: #ff8c9d; }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 5; display: flex; align-items: center; gap: 14px; max-width: calc(100% - 36px); padding: 13px 15px; border: 1px solid #91abbc50; border-radius: 14px; background: #0d141af2; color: var(--white); box-shadow: 0 16px 35px #0d141a99; }
.toast button { width: auto; margin: 0; padding: 7px 10px; background: var(--red); }
@media (max-width: 520px) {
  .shell { padding: 14px 10px 40px; }
  .card { padding: 17px; border-radius: 20px; }
  .topbar { align-items: flex-start; }
  .header-actions { flex-direction: column; align-items: flex-end; gap: 7px; }
  .stat-pill { font-size: .7rem; }
  .shortcut-hint { display: none; }
  .calendar-day, .calendar-blank { min-height: 46px; }
}
