@font-face { font-family: "Atkinson"; src: url(../assets/fonts/atkinson-hyperlegible-latin-400-normal.woff2) format("woff2"); font-weight: 400; }
@font-face { font-family: "Atkinson"; src: url(../assets/fonts/atkinson-hyperlegible-latin-700-normal.woff2) format("woff2"); font-weight: 700; }

:root { --ink: #1e2a23; --muted: #56645b; --line: #d6dfd0; --bg: #f4f7f1; --forest: #2f7a52; --red: #b3372d; --sun: #f2b632; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1.0625rem/1.55 "Atkinson", system-ui, sans-serif; }
body.bare { display: grid; min-height: 100vh; place-items: center; padding: 1rem; }
a { color: var(--forest); }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
h1 { font-size: 1.9rem; margin: .2rem 0 .6rem; line-height: 1.2; }
h2 { font-size: 1.25rem; margin: 0; }

.bar { background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 10; }
.bar-inner { max-width: 900px; margin: auto; padding: .8rem 1.25rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.bar-title { color: #fff; font-weight: 700; text-decoration: none; }
.bar nav { display: flex; gap: 1.25rem; }
.bar nav a { color: #dfe8e2; }

.main { max-width: 900px; margin: auto; padding: 1.5rem 1.25rem 7rem; }
body.bare .main { padding: 0; width: 100%; max-width: 420px; }
.back { margin: 0 0 .5rem; }
.back a::before { content: "‹ "; }
.help { color: var(--muted); max-width: 44rem; margin-top: 0; }
.small { font-size: .95rem; }
.empty { color: var(--muted); font-style: italic; }

.login-box { background: #fff; border-radius: 18px; padding: 2rem; box-shadow: 0 2px 0 var(--line); }
.login-box form, .narrow { display: grid; gap: 1rem; }
.login-box label, .narrow label { display: grid; gap: .35rem; font-weight: 700; }

.flash { border-radius: 12px; padding: .9rem 1.1rem; margin: 1rem 0; font-weight: 700; }
.flash.ok { background: #dcefdf; color: #1c5335; }
.flash.err { background: #f8dcd8; color: #7c1f18; }

.group-title { color: var(--muted); font-size: 1rem; margin: 2rem 0 .75rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .75rem; }
.tile { display: grid; gap: .2rem; background: #fff; border: 2px solid transparent; border-radius: 14px; padding: 1.1rem 1.2rem; text-decoration: none; color: var(--ink); }
.tile:hover { border-color: var(--forest); }
.tile span { color: var(--muted); font-size: .95rem; }
.tile-big strong { font-size: 1.2rem; }

.editor { display: grid; gap: 1.1rem; }
.field { display: grid; gap: .35rem; }
.field > label { font-weight: 700; }
.field-help { margin: 0; color: var(--muted); font-size: .95rem; }
input[type=text], input[type=password], input[type=date], textarea, select {
  width: 100%; font: inherit; color: inherit; background: #fff; border: 2px solid var(--line); border-radius: 10px; padding: .7rem .8rem;
}
input:focus, textarea:focus, select:focus { border-color: var(--forest); outline: none; }
textarea { resize: vertical; min-height: 3.5rem; }

.img-field { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.img-preview { width: 140px; height: 100px; border-radius: 10px; background: #fff; border: 2px dashed var(--line); display: grid; place-items: center; overflow: hidden; color: var(--muted); font-size: .9rem; }
.img-preview img { width: 100%; height: 100%; object-fit: cover; }
.img-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.img-field:not(.has-img) [data-remove-img] { display: none; }
.btn-file input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.btn-file:focus-within { outline: 3px solid var(--sun); }
.img-status { font-size: .95rem; color: var(--muted); }
.img-status.err { color: var(--red); font-weight: 700; }

.btn { position: relative; font: 700 1rem "Atkinson", system-ui, sans-serif; border: 0; border-radius: 999px; padding: .75rem 1.3rem; cursor: pointer; background: #e3eadf; color: var(--ink); text-decoration: none; display: inline-block; }
.btn:hover { background: #d4dfcf; }
.btn-primary { background: var(--forest); color: #fff; }
.btn-primary:hover { background: #245f40; }
.btn-add { background: var(--ink); color: #fff; }
.btn-add:hover { background: #33453a; }
.btn-small { padding: .5rem .95rem; font-size: .95rem; }
.btn-ghost { background: transparent; border: 2px solid var(--line); }
.btn-danger { background: transparent; color: var(--red); border: 2px solid #efc8c3; }
.btn-danger:hover { background: #f8dcd8; }

.list { margin-top: 1rem; }
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.count { color: var(--muted); font-weight: 400; }
.items { display: grid; gap: .6rem; }
.item { background: #fff; border-radius: 14px; border: 2px solid transparent; }
.item[open] { border-color: var(--line); }
.item summary { cursor: pointer; padding: 1rem 1.2rem; display: flex; justify-content: space-between; gap: 1rem; font-weight: 700; list-style: none; }
.item summary::-webkit-details-marker { display: none; }
.item summary::before { content: "▸"; color: var(--muted); }
.item[open] summary::before { content: "▾"; }
.item-title { flex: 1; }
.item-date { color: var(--muted); font-weight: 400; white-space: nowrap; }
.item-body { padding: 0 1.2rem 1.2rem; display: grid; gap: 1rem; }
.item-tools { display: flex; gap: .5rem; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 1rem; }
.item-tools [data-delete] { margin-left: auto; }
.item.flash-new { animation: pulse 1.2s ease 1; }
@keyframes pulse { from { box-shadow: 0 0 0 4px var(--sun); } to { box-shadow: 0 0 0 0 transparent; } }

.savebar { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: .8rem 1.25rem; display: flex; justify-content: flex-end; align-items: center; gap: 1rem; z-index: 5; }
.dirty-hint { color: #8a5a00; font-weight: 700; }

.panel { background: #fff; border-radius: 14px; padding: 1.4rem; margin-top: 1.25rem; }
.panel h2 { margin-bottom: .5rem; }
.backups { list-style: none; padding: 0; margin: 0; }
.backups li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .6rem 0; border-top: 1px solid var(--line); }
.backups form { margin: 0; }

@media (max-width: 600px) {
  .img-preview { width: 100%; height: 160px; }
  .item-tools [data-delete] { margin-left: 0; }
  .savebar .btn { width: 100%; }
  .dirty-hint { display: none !important; }
}
