:root {
  color-scheme: light;
  --canvas: #f7f7f0;
  --sidebar: #eeefe5;
  --white: #fffefa;
  --ink: #292d22;
  --muted: #616756;
  --line: #dcdfd0;
  --green: #405138;
  --green-dark: #2b3d25;
  --tint: #e1e7d6;
  --danger: #9c342a;
  font-family: "Hiragino Sans", "Yu Gothic", Meiryo, system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 0; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid #527847; outline-offset: 3px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow: auto;
  background: var(--sidebar); border-right: 1px solid var(--line);
  padding: 34px 22px 25px; display: flex; flex-direction: column; gap: 45px;
}
.brand { display: flex; align-items: center; gap: 12px; padding-inline: 6px; }
.brand-mark {
  display: grid; place-items: center; flex: 0 0 43px; height: 43px;
  background: var(--green); color: #f2f0dc; border-radius: 13px; font-size: 26px;
}
.brand-name { font-size: 21px; font-weight: 800; letter-spacing: .12em; line-height: 1.3; }
.brand-caption { font-size: .8125rem; color: var(--muted); margin-top: 3px; }
.sidebar-content { flex: 1; display: flex; flex-direction: column; justify-content: space-between; gap: 38px; }
.nav-button, .utility {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 43px;
  padding: 8px 11px; background: transparent; border: 1px solid transparent;
  border-radius: 8px; text-align: start; font-size: .875rem;
}
.nav-button { overflow-wrap: anywhere; }
.nav-button[aria-pressed="true"] { background: var(--tint); color: var(--green-dark); font-weight: 700; }
.nav-button:hover, .utility:hover:not(:disabled) { background: #dce3d1; }
.nav-count { margin-inline-start: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.tags-panel { margin-top: 29px; }
.tags-panel summary {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 40px; padding-inline: 11px; border-radius: 8px; list-style: none;
  color: var(--muted); font-size: .875rem; font-weight: 700; cursor: pointer;
}
.tags-panel summary::-webkit-details-marker { display: none; }
.tags-panel summary::after, .sort::after {
  content: ""; width: 7px; height: 7px; border-right: 1.5px solid; border-bottom: 1.5px solid;
  transform: rotate(45deg) translateY(-2px);
}
.tags-panel[open] summary::after { transform: rotate(225deg) translate(-2px, -1px); }
.tag-hint { padding: 1px 11px; color: var(--muted); font-size: .8125rem; line-height: 1.7; }
.sidebar-label { padding: 0 11px 5px; color: var(--muted); font-weight: 700; font-size: .875rem; }
.backup { padding-top: 16px; border-top: 1px solid var(--line); }
.icon { display: inline-block; width: 16px; height: 16px; position: relative; flex: 0 0 16px; }
.icon-grid {
  background: linear-gradient(currentColor 0 0) 1px 1px / 5px 5px,
    linear-gradient(currentColor 0 0) 9px 1px / 5px 5px,
    linear-gradient(currentColor 0 0) 1px 9px / 5px 5px,
    linear-gradient(currentColor 0 0) 9px 9px / 5px 5px;
  background-repeat: no-repeat;
}
.icon-search::before { content: ""; position: absolute; inset: 0 4px 4px 0; border: 1.6px solid; border-radius: 50%; }
.icon-search::after {
  content: ""; position: absolute; width: 7px; height: 1.6px; top: 12px; left: 9px;
  background: currentColor; transform: rotate(45deg); border-radius: 2px;
}
.icon-download, .icon-upload { border: 1.5px solid currentColor; border-top: 0; border-radius: 2px; height: 6px; margin-top: 8px; }
.icon-download::before, .icon-upload::before {
  content: ""; position: absolute; width: 1.5px; height: 8px; left: 5.5px; top: -8px; background: currentColor;
}
.icon-download::after, .icon-upload::after {
  content: ""; position: absolute; width: 6px; height: 6px; left: 3.5px; top: -6px;
  border-right: 1.5px solid; border-bottom: 1.5px solid; transform: rotate(45deg);
}
.icon-upload::after { top: -8px; transform: rotate(225deg); }
.icon-lock::before { content: ""; position: absolute; inset: 1px 5px 6px; border: 1px solid; border-radius: 6px; }
.icon-lock::after { content: ""; position: absolute; inset: 6px 3px 2px; border: 1px solid; background: var(--canvas); border-radius: 2px; }
.main {
  width: min(100%, 1320px); margin-inline: auto; padding: 51px clamp(24px, 4.6vw, 74px) 24px;
  display: flex; flex-direction: column;
}
.page-heading, .collection-heading { display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.page-heading { padding-bottom: 36px; border-bottom: 1px solid var(--line); }
h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); letter-spacing: .045em; line-height: 1.24; font-weight: 800; }
.page-heading p { margin-top: 12px; color: var(--muted); line-height: 1.5; }
.primary, .secondary, .danger-quiet {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 9px 15px; border: 1px solid transparent;
  border-radius: 8px; font-size: .9375rem; font-weight: 700; white-space: nowrap;
}
.primary { background: var(--green); color: #fff; }
.primary:hover { background: var(--green-dark); }
.secondary { background: var(--white); color: var(--green-dark); border-color: #c9d0be; }
.secondary:hover { background: #eef2e7; }
.plus { font-size: 1.15em; line-height: 1; }
.collection { padding-top: 25px; }
.collection-heading { margin-bottom: 20px; flex-wrap: wrap; }
.heading-with-count, .toolbar { display: flex; align-items: center; gap: 10px; min-width: 0; }
.heading-with-count h2 { font-size: 1.125rem; overflow-wrap: anywhere; }
.item-count { color: var(--green-dark); background: var(--tint); border-radius: 20px; padding: 3px 9px; font-size: .875rem; white-space: nowrap; }
.search, .sort { display: flex; position: relative; align-items: center; min-width: 0; }
.search .icon { position: absolute; left: 12px; pointer-events: none; color: var(--muted); }
.search input, .sort select {
  border: 1px solid var(--line); border-radius: 8px; background: var(--white);
  min-height: 44px; width: 100%;
}
.search input { width: clamp(155px, 19vw, 254px); padding: 0 10px 0 37px; }
.sort select { appearance: none; padding: 0 33px 0 10px; font-size: .875rem; cursor: pointer; }
.sort::after { position: absolute; right: 13px; pointer-events: none; }
.feedback:empty { display: none; }
.feedback {
  color: var(--green-dark); background: var(--tint); padding: 10px 14px;
  border-radius: 8px; margin-bottom: 15px; overflow-wrap: anywhere;
}
.feedback[data-error] { color: var(--danger); background: #faebe7; }
.empty {
  min-height: 377px; border: 1px dashed #c4cbb8; border-radius: 15px;
  background: radial-gradient(ellipse at center 18%, #f0f2e7, var(--white) 68%);
  padding: 34px 18px; text-align: center;
  display: flex; align-items: center; justify-content: center; flex-direction: column;
}
.illustration { position: relative; width: 138px; height: 124px; margin-bottom: 17px; color: #53694a; }
.paper {
  position: absolute; width: 71px; height: 88px; border: 1px solid #9da98f; border-radius: 9px;
  box-shadow: 0 6px 15px #3e55351a;
}
.paper-back { left: 23px; top: 23px; transform: rotate(-15deg); background: #dce6cf; }
.paper-front {
  left: 47px; top: 17px; transform: rotate(10deg); background: #fffef7;
  display: grid; align-content: center; justify-items: start; gap: 8px; padding-left: 15px;
}
.paper-front span { width: 33px; height: 2px; border-radius: 2px; background: #a3ad95; }
.paper-front span:last-child { width: 22px; }
.spark { position: absolute; }
.spark-large { right: 1px; top: 0; font-size: 30px; }
.spark-small { left: 0; bottom: 4px; font-size: 25px; }
.empty h3 { font-size: 1.25rem; }
.empty p { color: var(--muted); margin: 9px 0 20px; line-height: 1.65; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 248px), 1fr)); gap: 15px; }
.card {
  min-width: 0; background: var(--white); border: 1px solid var(--line);
  border-radius: 13px; overflow: hidden; display: flex; flex-direction: column;
}
.card:hover, .card:focus-within { border-color: #a6b39b; }
.card-open {
  border: 0; background: none; display: grid; align-content: start; gap: 8px;
  width: 100%; flex: 1; padding: 17px 18px; text-align: start; overflow-wrap: anywhere;
}
.card-open:focus-visible { outline-offset: -3px; }
.card-open time { color: var(--muted); font-size: .875rem; }
.card-title, .card-body { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.card-title { font-size: 1.14rem; font-weight: 750; -webkit-line-clamp: 2; }
.card-body { color: var(--muted); line-height: 1.6; white-space: pre-wrap; -webkit-line-clamp: 3; }
.card-tags { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 17px 12px; }
.card-tags:empty { display: none; }
.chip {
  border: 0; border-radius: 7px; background: #eaf0e1; color: var(--green-dark);
  font-size: .875rem; min-height: 36px; max-width: 100%; padding: 4px 9px; overflow-wrap: anywhere;
}
.chip:hover, .chip[aria-pressed="true"] { background: #dce6cd; }
.footer { color: var(--muted); font-size: .875rem; display: flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 24px; }
dialog {
  width: min(560px, calc(100% - 24px)); max-height: calc(100% - 24px);
  overflow: auto; padding: 22px; border: 1px solid var(--line);
  background: var(--white); border-radius: 14px; box-shadow: 0 15px 60px #252f2440;
}
dialog::backdrop { background: #252f2470; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 15px; }
.dialog-header h2 { font-size: 1.25rem; }
.close { color: var(--muted); background: none; border: 0; border-radius: 8px; width: 44px; height: 44px; font-size: 1.5rem; }
.close:hover { background: var(--sidebar); }
.fields { display: grid; gap: 13px; }
.fields label { display: block; font-size: .9375rem; font-weight: 700; }
.fields input, .fields textarea {
  display: block; width: 100%; padding: 10px 11px; margin-top: 6px;
  background: var(--white); border: 1px solid #c8cebf; border-radius: 7px; font-size: 1rem; font-weight: 400;
}
.fields textarea { resize: vertical; min-height: 90px; }
.required { font-size: .8125rem; color: var(--muted); margin-left: 4px; }
.field-hint { margin-top: -7px; font-size: .875rem; color: var(--muted); }
.form-error { color: var(--danger); margin-top: 12px; }
.dialog-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 21px; }
.danger-quiet { color: var(--danger); background: none; margin-right: auto; }
.danger-quiet:hover { background: #faebe7; }
.primary.danger { background: var(--danger); }
.primary.danger:hover { background: #7a251d; }
.confirm-description { line-height: 1.7; overflow-wrap: anywhere; }
@media (max-width: 800px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: static; height: auto; overflow: visible;
    padding: 12px 18px; border-right: 0; border-bottom: 1px solid var(--line);
    gap: 10px;
  }
  .brand { padding: 0; }
  .brand-mark { flex-basis: 35px; height: 35px; font-size: 21px; border-radius: 9px; }
  .brand-name { font-size: 18px; }
  .brand-caption { margin-top: 0; }
  .sidebar-content { flex-direction: row; align-items: flex-start; flex-wrap: wrap; gap: 4px 12px; }
  .navigation { display: flex; align-items: flex-start; flex-wrap: wrap; flex: 1; gap: 3px; min-width: min(100%, 190px); }
  .navigation > .nav-button, .utility { width: auto; }
  .tags-panel { min-width: 62px; margin: 0; flex: 1; }
  .tags-panel summary { min-height: 43px; min-width: 62px; }
  .tag-nav { display: flex; flex-wrap: wrap; }
  .tag-nav .nav-button { width: auto; max-width: 100%; }
  .backup { display: flex; flex-wrap: wrap; border: 0; padding: 0; }
  .sidebar-label { display: none; }
  .main { min-height: 60vh; padding: 28px 18px 20px; }
  .page-heading { padding-bottom: 24px; }
  .page-heading p { margin-top: 6px; }
  .collection { padding-top: 18px; }
  .empty { min-height: 325px; }
}
@media (max-width: 495px) {
  .navigation { min-width: 0; flex-basis: 100%; }
  .sidebar-content { gap: 2px; }
  .backup .utility { padding-inline: 9px; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 13px; }
  .toolbar { width: 100%; gap: 6px; }
  .search { flex: 1; }
  .search input { width: 100%; }
  .sort select { padding-right: 26px; }
  .sort::after { right: 10px; }
  .collection-heading { gap: 12px; }
}
@media (pointer: coarse) { .chip { min-height: 44px; } }
