:root {
  --bg: #f4f4f1;
  --panel: #ffffff;
  --ink: #15161a;
  --muted: #6d6f78;
  --line: #e6e6e1;
  --accent: #2f5bff;
  --accent-ink: #ffffff;
  --soft: #eef1ff;
  --ok: #17915a;
  --err: #d13b3b;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 30px rgba(20,22,30,.06);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0f12; --panel: #17181d; --ink: #f1f1ee; --muted: #9a9ca6; --line: #26282f;
    --accent: #5b7cff; --soft: #1c2240; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 30px rgba(0,0,0,.3);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.45;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }
svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
h1, h2, h3 { letter-spacing: -.02em; line-height: 1.15; margin: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  font: inherit; font-weight: 600; font-size: 15px; padding: 12px 18px; border-radius: 14px;
  cursor: pointer; text-decoration: none; transition: transform .12s ease, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--err); }
.btn.big { width: 100%; padding: 16px; font-size: 16px; border-radius: 16px; }
.btn.sm { padding: 8px 12px; font-size: 13px; border-radius: 10px; }

input, textarea, select {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
textarea { resize: vertical; min-height: 84px; }
label.f { display: block; }
label.f > span { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px 2px; }

.muted { color: var(--muted); }
.err { color: var(--err); font-size: 14px; min-height: 20px; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0;
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-size: 14px;
  transition: all .25s ease; z-index: 50; pointer-events: none; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Публичная карточка ---------- */
.card-page { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; padding: 28px 16px 20px; }
.card {
  width: 100%; max-width: 420px; background: var(--panel); border-radius: 28px; box-shadow: var(--shadow);
  padding: 32px 20px 20px; text-align: center; position: relative; overflow: hidden;
}
.card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 110px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 45%, #9b5cff));
}
.avatar {
  position: relative; width: 112px; height: 112px; border-radius: 50%; object-fit: cover;
  border: 5px solid var(--panel); margin: 18px auto 14px; display: block; background: var(--soft);
}
.avatar.ph { display: grid; place-items: center; font-size: 38px; font-weight: 700; color: var(--accent); }
.avatar.ph svg { width: 44px; height: 44px; }
.card h1 { font-size: 26px; }
.card .sub { color: var(--muted); margin: 6px 0 0; }
.card #save { margin-top: 22px; }
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.quick a, .quick button {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px;
  background: var(--soft); color: var(--accent); border: 0; border-radius: 14px; font: inherit;
  font-size: 12px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.rows { margin-top: 18px; text-align: left; border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 14px; padding: 12px 4px; text-decoration: none; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .ic { width: 38px; height: 38px; border-radius: 12px; background: var(--soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.row .rt { display: flex; flex-direction: column; min-width: 0; }
.row small { color: var(--muted); font-size: 12px; }
.row b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note { margin: 16px 4px 4px; text-align: left; color: var(--muted); font-size: 14px; white-space: pre-line; }
.card.msg { padding-bottom: 28px; }
.card.msg .btn { margin-top: 20px; }
.foot { margin-top: 18px; font-size: 13px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.foot a { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.foot svg { width: 16px; height: 16px; }
.autosave-hint { margin-top: 10px; font-size: 13px; color: var(--muted); }
