:root {
  --ink: #14100d;
  --ink-2: #5f554c;
  --paper: #fffaf2;
  --card: #ffffff;
  --leather: #ffd9a1;
  --pink: #f9a0b2;
  --pink-deep: #d6456a;
  --stitch: #eadcc6;
  --line: #eadfce;
  --signal: #14100d;
  --signal-dark: #3a2f27;
  --danger: #a13a2a;
  --radius: 18px;
  --font: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font); font-size: 16px; line-height: 1.5;
}
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; } h2 { font-size: 18px; }
p { margin: 0 0 12px; }
a { color: var(--signal-dark); }
img { max-width: 100%; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 6px; }

/* ---------- top bar ---------- */
.topbar { background: var(--paper); color: var(--ink); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 560px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; letter-spacing: .01em; color: var(--ink); text-decoration: none; margin-right: auto; }
.brand::before { content: ""; width: 40px; height: 40px; background: url(/assets/logo.png) center / cover no-repeat; border-radius: 10px; flex: none; }
.lang { display: flex; gap: 4px; }
.lang button {
  font: inherit; font-size: 13px; font-weight: 700; color: var(--ink); background: transparent;
  border: 1px solid var(--ink); border-radius: 8px; padding: 4px 9px; cursor: pointer;
}
.lang button[aria-pressed="true"] { background: var(--pink); color: var(--ink); }
.topbar .link-btn { color: var(--ink); }

.wrap { max-width: 560px; margin: 0 auto; padding: 20px 16px 56px; }
.sub { color: var(--ink-2); margin-top: 6px; }
.page-head { margin-bottom: 18px; }

/* ---------- cards & forms ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 16px; margin-bottom: 16px; }
.card > h2 { margin-bottom: 14px; }

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.lbl { font-weight: 600; font-size: 15px; }
.hint { color: var(--ink-2); font-size: 13px; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date], textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff;
  border: 1.5px solid #d9ccb8; border-radius: 14px; padding: 12px 13px; min-height: 48px;
}
textarea { min-height: 92px; resize: vertical; }
input:focus, textarea:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 4px rgba(249,160,178,.55); }

.check { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0; font-size: 15px; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--pink-deep); flex: none; }

/* switch: "show on the tag" */
.sw { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; user-select: none; white-space: nowrap; }
.sw input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sw .track { width: 40px; height: 24px; border-radius: 24px; background: #d9ccb8; position: relative; flex: none; }
.sw .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.sw input:checked + .track { background: var(--pink-deep); }
.sw input:checked + .track::after { left: 19px; }
.sw input:focus-visible + .track { outline: 3px solid var(--ink); outline-offset: 2px; }
.sw .on { display: none; color: var(--ink); font-weight: 700; }
.sw input:checked ~ .on { display: inline; }
.sw input:checked ~ .off { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .sw .track, .sw .track::after { transition: all .15s ease; }
}

/* ---------- buttons ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  min-height: 52px; padding: 12px 18px; font: inherit; font-weight: 700; font-size: 17px;
  border: 0; border-radius: 999px; cursor: pointer; text-decoration: none;
  background: var(--ink); color: #fff;
}
.btn:hover { background: var(--pink); color: var(--ink); }
.btn.ink { background: var(--ink); } .btn.ink:hover { background: var(--pink); color: var(--ink); }
.btn.accent { background: var(--pink); color: var(--ink); } .btn.accent:hover { background: #f58aa1; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }
.btn.ghost:hover { background: var(--leather); color: var(--ink); }
.btn.small { width: auto; min-height: 40px; font-size: 15px; padding: 8px 14px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-stack { display: grid; gap: 10px; margin: 16px 0; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--signal-dark); text-decoration: underline; cursor: pointer; }
.danger-link { color: var(--danger); }

.msg { border-radius: 10px; padding: 10px 12px; margin: 12px 0; font-size: 15px; }
.msg.err { background: #fbe9e5; color: #7d281b; }
.msg.ok { background: #e1f2ec; color: #0e4f3c; }
.msg.info { background: #fff1d9; color: var(--ink); }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); max-width: calc(100% - 32px);
  background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 15px; z-index: 50;
}
.toast.err { background: var(--danger); }

/* ---------- the leather tag (scan page + dashboard) ---------- */
.tag {
  position: relative; background: var(--leather); color: var(--ink);
  border-radius: 28px; padding: 44px 22px 24px; margin: 22px 0 18px;
  border: 1.5px solid var(--ink);
}
.tag::before { /* stitching */
  content: ""; position: absolute; inset: 8px; border: 1px solid rgba(20,16,13,.35); border-radius: 21px; pointer-events: none;
}
.tag::after { /* punched hole */
  content: ""; position: absolute; top: 14px; left: 50%; width: 16px; height: 16px; margin-left: -8px;
  border-radius: 50%; background: var(--paper); border: 1.5px solid var(--ink);
}
.tag-body { display: flex; align-items: center; gap: 16px; }
.tag-photo { width: 92px; height: 92px; border-radius: 50%; object-fit: cover; flex: none; border: 2px solid var(--ink); background: #fff3dc; }
.tag-kicker { font-size: 14px; font-weight: 600; opacity: .85; margin-bottom: 2px; }
.tag-name { font-size: 36px; font-weight: 900; line-height: 1.02; letter-spacing: -0.025em; overflow-wrap: anywhere; }

/* ---------- info rows ---------- */
.rows { margin: 0; padding: 0; }
.rows .row { display: grid; grid-template-columns: 112px 1fr; gap: 6px 12px; padding: 12px 0; border-bottom: 1px solid var(--stitch); }
.rows .row:last-child { border-bottom: 0; }
.rows dt { color: var(--ink-2); font-size: 14px; }
.rows dd { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }
@media (max-width: 360px) { .rows .row { grid-template-columns: 1fr; } }

/* ---------- dashboard list ---------- */
.pet-item { display: flex; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--stitch); }
.pet-item:last-child { border-bottom: 0; }
.pet-item img, .pet-item .ph { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: #fff3dc; border: 2px solid var(--ink); flex: none; }
.pet-item .grow { flex: 1; min-width: 0; }
.pet-item .nm { font-weight: 700; font-size: 18px; overflow-wrap: anywhere; }
.pet-item .code { color: var(--ink-2); font-size: 13px; }

/* ---------- pet form bits ---------- */
.photo-edit { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.photo-edit .tag-photo { width: 84px; height: 84px; }
.file-row, .hist-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--stitch); }
.file-row:last-child, .hist-row:last-child { border-bottom: 0; }
.file-row .nm { overflow-wrap: anywhere; min-width: 0; }
.hist-row { font-size: 14px; }
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tabs button { flex: 1; font: inherit; font-weight: 700; padding: 11px 8px; border-radius: 999px; border: 1.5px solid var(--ink); background: transparent; color: var(--ink); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.foot { margin-top: 26px; color: var(--ink-2); font-size: 13px; text-align: left; }
.prose h2 { margin: 22px 0 8px; } .prose ul { padding-left: 20px; margin: 0 0 12px; } .prose li { margin-bottom: 6px; }
.sticky-save { position: sticky; bottom: 0; background: var(--paper); border-top: 1px solid var(--stitch); padding: 12px 0; margin-top: 8px; }

/* ---------- support block ---------- */
.support { margin-top: 28px; padding: 18px 16px; border-radius: var(--radius); background: #fff1d9; border: 1px solid var(--line); }
.support h2 { margin-bottom: 12px; }
