.card {
  background: var(--card);
  border: 1px solid var(--bd);
  border-radius: var(--radius-card);
  padding: 14px;
}

.hero {
  margin: 14px 0;
  background: linear-gradient(135deg, var(--ac-strong), var(--hero-end));
  color: var(--acx);
  border: 0;
}

.hero-label {
  font-size: var(--fs-meta);
  font-weight: 500;
}

.hero b {
  display: block;
  font-size: 40px;
  line-height: 1.1;
}

.hero .row {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  margin-top: 10px;
}

.hero strong {
  display: block;
  font-size: var(--fs-body);
}

.hero small {
  display: block;
  color: var(--acx);
  font-size: 12px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.cat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 76px;
  min-width: 0;
  padding: 8px 2px;
  border: 1px solid var(--bd);
  border-radius: 14px;
  background: var(--card);
  color: var(--tx);
  font-size: 11px;
  line-height: 1.25;
  text-align: center;
  overflow-wrap: anywhere;
}

.cat span {
  display: block;
  font-size: 22px;
  line-height: 1.1;
}

.cat em {
  color: var(--mut);
  font-style: normal;
  font-size: 11px;
}

.doc {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  margin-bottom: 8px;
  padding: 12px;
  border: 1px solid var(--bd);
  border-radius: var(--radius-card);
  background: var(--card);
  color: var(--tx);
  text-align: left;
  text-decoration: none;
}

button.doc {
  font: inherit;
}

.ico {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--card2);
  font-size: 22px;
  line-height: 1;
}

.ico-big {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  font-size: 36px;
}

.doc-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.doc b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.meta {
  display: block;
  overflow: hidden;
  color: var(--mut);
  font-size: var(--fs-meta);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  flex: none;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: var(--fs-badge);
  font-weight: 600;
  white-space: nowrap;
}

.b-ok {
  background: #16a34a22;
  color: var(--ok-ink);
}

.b-warn {
  background: #fbbf2422;
  color: var(--warn-ink);
}

.b-bad {
  background: #f8717122;
  color: var(--bad-ink);
}

.b-no {
  background: var(--card2);
  color: var(--mut);
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.av {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #db2777;
  color: #ffffff;
  font-weight: 700;
}

.search {
  margin: 8px 0;
}

input,
select,
textarea {
  width: 100%;
  min-height: var(--touch);
  margin: 4px 0 10px;
  padding: 12px;
  border: 1px solid var(--bd);
  border-radius: var(--radius-input);
  background: var(--card);
  color: var(--tx);
}

textarea {
  min-height: 72px;
  resize: vertical;
}

label {
  display: block;
  margin-top: 4px;
  color: var(--mut);
  font-size: 12px;
}

.btn {
  display: block;
  width: 100%;
  min-height: var(--touch);
  padding: 14px;
  border: 0;
  border-radius: var(--radius-control);
  background: var(--ac-strong);
  color: var(--acx);
  font-size: var(--fs-body);
  font-weight: 600;
  text-align: center;
}

.btn.sec {
  background: var(--card2);
  color: var(--tx);
}

.btn.del {
  background: #f8717122;
  color: var(--bad-ink);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.back {
  min-height: var(--touch);
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--ac-strong);
  font-size: var(--fs-body);
}

.link-button {
  min-height: var(--touch);
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--ac-strong);
  font-size: var(--fs-meta);
  text-decoration: underline;
  text-underline-offset: 2px;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--ac-strong);
}

.chips {
  display: flex;
  gap: 6px;
  margin: 8px 0 12px;
  padding-bottom: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: none;
  min-height: var(--touch);
  padding: 8px 14px;
  border: 1px solid var(--bd);
  border-radius: 99px;
  background: var(--card);
  color: var(--tx);
  font-size: var(--fs-meta);
  white-space: nowrap;
}

.chip.on {
  border-color: var(--ac-strong);
  background: var(--ac-strong);
  color: var(--acx);
}

.warnbox {
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid #fbbf2455;
  border-radius: var(--radius-input);
  background: #fbbf2418;
  color: var(--warn-ink);
  font-size: var(--fs-meta);
}

.nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--bd);
  background: var(--card);
}

.nav-inner {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
}

.nav-link {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--touch);
  border-radius: 12px;
  color: var(--mut);
  font-size: 11px;
  text-decoration: none;
}

.nav-link span {
  font-size: 20px;
  line-height: 1;
}

.nav-link.on {
  color: var(--ac-strong);
}

.plus {
  display: grid;
  flex: none;
  place-items: center;
  width: 54px;
  height: 54px;
  margin: -24px 8px 0;
  border-radius: 50%;
  background: var(--ac-strong);
  color: var(--acx);
  font-size: 28px;
  line-height: 1;
  text-decoration: none;
}

.kv {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--bd);
}

.kv:last-child {
  border-bottom: 0;
}

.kv > :last-child {
  margin-left: auto;
  text-align: right;
  overflow-wrap: anywhere;
}

.kv select {
  width: auto;
  min-height: var(--touch);
  margin: 0;
  padding: 8px 10px;
}

.kv-value {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.list-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.list-head h1 {
  min-width: 0;
  overflow-wrap: anywhere;
}

.head-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 2px;
  padding-top: 2px;
}

.head-actions .link-button {
  min-height: var(--touch);
}

.detail-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 8px 0 14px;
  text-align: center;
}

.detail-head h1 {
  margin: 0;
}

.row-actions {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.switch-card {
  margin-top: 12px;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--touch);
  color: var(--tx);
  font-size: var(--fs-body);
}

.switch-row input {
  width: auto;
  min-height: auto;
  margin: 0;
  transform: scale(1.2);
}

.file-summary {
  margin: 10px 0;
}

.inline-add {
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px dashed var(--bd);
  border-radius: var(--radius-input);
  background: var(--card2);
}

.inline-add summary {
  display: flex;
  align-items: center;
  min-height: var(--touch);
  color: var(--ac-strong);
  font-size: var(--fs-meta);
  cursor: pointer;
}

.inline-add[open] summary {
  margin-bottom: 4px;
}

.inline-add label {
  margin-top: 0;
}

.inline-add .btn {
  margin-top: 4px;
}

.file-summary .btn {
  margin-top: 10px;
}

.file-name {
  margin: 4px 0;
  overflow: hidden;
  color: var(--tx);
  font-size: var(--fs-meta);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  z-index: 40;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 99px;
  background: var(--tx);
  color: var(--bg);
  font-size: var(--fs-meta);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.6);
}

.modal {
  width: 100%;
  max-width: 400px;
  max-height: 80vh;
  padding: 16px;
  overflow: auto;
  border: 1px solid var(--bd);
  border-radius: var(--radius-card);
  background: var(--card);
}

.modal h2 {
  margin-top: 0;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.cat-manager-list {
  max-height: 45vh;
  margin: 8px 0;
  overflow: auto;
}

.cat-item,
.cat-edit,
.cat-delete {
  padding: 4px 0;
  border-bottom: 1px solid var(--bd);
}

.cat-item:last-child,
.cat-edit:last-child,
.cat-delete:last-child {
  border-bottom: 0;
}

.cat-item .kv {
  padding: 4px 0;
  border-bottom: 0;
}

.cat-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding-bottom: 6px;
}

.cat-actions .btn {
  flex: 1;
  width: auto;
  padding: 10px 12px;
}

.link-button.danger {
  color: var(--bad-ink);
}

.cat-edit {
  padding-bottom: 10px;
}

.emoji-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 4px 0 6px;
}

.emoji-preset {
  width: var(--touch);
  height: var(--touch);
  min-width: var(--touch);
  min-height: var(--touch);
  padding: 0;
  border: 1px solid var(--bd);
  border-radius: var(--radius-input);
  background: var(--card);
  font-size: 22px;
}

.cat-delete {
  padding-bottom: 10px;
}

.cat-delete-title {
  margin: 4px 0;
  font-weight: 600;
}

.cat-delete .cat-actions {
  padding-top: 8px;
}

.pin-mark {
  font-size: 44px;
  line-height: 1;
}

.dots {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin: 24px 0;
}

.dots i {
  width: 14px;
  height: 14px;
  border: 2px solid var(--ac-strong);
  border-radius: 50%;
}

.dots i.f {
  background: var(--ac-strong);
}

.pad {
  display: grid;
  grid-template-columns: repeat(3, 72px);
  gap: 14px;
  justify-content: center;
}

.pad > span {
  width: 72px;
  height: 72px;
}

.pad-key {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  min-width: 72px;
  min-height: 72px;
  padding: 0;
  border: 1px solid var(--bd);
  border-radius: 50%;
  background: var(--card);
  color: var(--tx);
  font-size: 24px;
}

.pin-hint {
  margin-top: 28px;
}

@media (max-width: 360px) {
  .pad {
    grid-template-columns: repeat(3, 68px);
    gap: 10px;
  }

  .pad > span,
  .pad-key {
    width: 68px;
    height: 68px;
    min-width: 68px;
    min-height: 68px;
  }

  .hero .row {
    gap: 14px;
  }
}
