/* Nova Card, the app. Made for an iPhone's home screen first; works in any browser. */
:root {
	--ink: #0e1116;
	--muted: #4b5060;        /* 8.1:1 on white, 7.4:1 on --bg */
	--bg: #f3f2f7;
	--card: #ffffff;
	--line: #e3e1ec;
	--field: #8d91a0;        /* 3.2:1 boundary on white */
	--accent: #5b3df5;       /* 6.1:1 with white */
	--accent-ink: #ffffff;
	--accent-soft: #ece8ff;
	--accent-deep: #3b25b8;  /* words on --accent-soft */
	--link: var(--accent);   /* words in the accent colour: links, the tab you're on */
	--mark: var(--accent);   /* pictures in it: icons. A company's own copy sets all of these (src/brand.js) */
	--danger: #b42318;
	--ok: #067647;
	--focus: #1a56db;
	--top: #16123a;
	--tabs-h: 62px;
	color-scheme: light;
}
* { box-sizing: border-box; }
img { max-width: 100%; height: auto; }
/* The screen takes focus when it changes, for screen readers; no ring round the whole of it. */
#view:focus { outline: none; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
	margin: 0;
	min-height: 100%;
	background: var(--bg);
	color: var(--ink);
	font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	-webkit-tap-highlight-color: transparent;
}
a { color: var(--link); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- frame ---------- */
.top {
	position: sticky; top: 0; z-index: 5;
	background: var(--top); color: #fff;
	padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
	display: flex; align-items: center; gap: 10px; min-height: 52px;
}
.top :focus-visible { outline-color: #fff; } /* the usual blue ring is too faint on the dark bar */
.top h1 { font-size: 18px; margin: 0; font-weight: 700; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.top .back { color: #fff; text-decoration: none; font-weight: 600; display: flex; align-items: center; gap: 2px; padding: 6px 8px 6px 0; }
.top .back::before { content: ""; width: 10px; height: 10px; border-left: 2.5px solid #fff; border-bottom: 2.5px solid #fff; transform: rotate(45deg); margin-right: 6px; }
.net { font-size: 13px; background: #fff3c4; color: var(--ink); border-radius: 999px; padding: 3px 10px; font-weight: 600; }
main { max-width: 640px; margin: 0 auto; padding: 16px 16px calc(var(--tabs-h) + 28px + env(safe-area-inset-bottom)); outline: none; }

.tabs {
	position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
	display: grid; grid-template-columns: repeat(4, 1fr);
	background: rgba(255, 255, 255, .97); border-top: 1px solid var(--line);
	padding-bottom: env(safe-area-inset-bottom);
	backdrop-filter: saturate(1.4) blur(12px);
}
.tabs a {
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
	height: var(--tabs-h); text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 600;
}
.tabs a[aria-current="page"] { color: var(--link); }
.tabs a[aria-current="page"] svg { color: var(--mark); }
.tabs svg { width: 26px; height: 26px; }

#toast {
	position: fixed; left: 50%; transform: translateX(-50%);
	bottom: calc(var(--tabs-h) + 14px + env(safe-area-inset-bottom)); z-index: 9;
	max-width: min(92vw, 520px); width: max-content;
	background: var(--ink); color: #fff; font-weight: 600;
	padding: 12px 16px; border-radius: 12px; box-shadow: 0 6px 24px rgba(14, 17, 22, .25);
	visibility: hidden; pointer-events: none;
}
#toast.on { visibility: visible; }
#toast.bad { background: var(--danger); }

/* ---------- building blocks ---------- */
h2 { font-size: 22px; margin: 4px 0 12px; letter-spacing: -.01em; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 4px 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.testbar { background: #fff3c4; color: var(--ink); border: 1px solid #e0c35a; border-radius: 10px; padding: 9px 12px; margin: 0 0 14px; font-size: 14px; font-weight: 600; }
.panel { background: var(--card); border-radius: 16px; padding: 16px; box-shadow: inset 0 0 0 1px var(--line); margin-bottom: 14px; }
.list { list-style: none; margin: 0 0 14px; padding: 0; background: var(--card); border-radius: 16px; box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.list li + li { border-top: 1px solid var(--line); }
.list a, .list button.row, .list div.row {
	display: flex; align-items: center; gap: 12px; width: 100%;
	padding: 13px 14px; min-height: 58px; text-decoration: none; color: var(--ink);
	background: none; border: 0; font: inherit; text-align: left; cursor: pointer;
}
.list .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.list .grow b { font-weight: 600; overflow-wrap: anywhere; }
/* Wraps, never cut off with an ellipsis: everything shows on a phone. */
.list .grow small { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.list .grow small.bad { color: var(--danger); }
.list div.row { cursor: default; }
.chev { width: 8px; height: 8px; border-right: 2px solid var(--muted); border-top: 2px solid var(--muted); transform: rotate(45deg); flex: none; margin-right: 4px; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(14, 17, 22, .25); }
.badge { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-deep); flex: none; }
.badge.plain { background: var(--bg); color: var(--muted); }
.badge.warn { background: #fff3c4; color: var(--ink); box-shadow: inset 0 0 0 1px #e0c35a; }
.avatar { width: 42px; height: 42px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; background: var(--accent-soft); color: var(--accent-deep); object-fit: cover; }

.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	font: inherit; font-weight: 700; font-size: 16px; text-decoration: none; cursor: pointer;
	padding: 12px 16px; min-height: 48px; border-radius: 12px; border: 0;
	background: var(--accent); color: var(--accent-ink);
}
.btn.wide { width: 100%; }
.btn.quiet { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1px var(--field); }
.btn.danger { background: var(--card); color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
.btn[disabled] { background: #d8d6e2; color: var(--ink); box-shadow: none; cursor: progress; }
.btn svg { width: 20px; height: 20px; }
.row-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.row-btns > * { flex: 1 1 140px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin: 0 0 14px; }
.tile {
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
	padding: 12px 6px; min-height: 84px; border-radius: 14px; border: 0; cursor: pointer;
	background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line);
	font: inherit; font-size: 14px; font-weight: 600; text-decoration: none; text-align: center;
}
.tile svg { width: 26px; height: 26px; color: var(--mark); }
.tile:active, .btn:active { transform: translateY(1px); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 2px 10px; margin: 0 -2px 4px; }
.chip {
	max-width: 100%; overflow-wrap: anywhere; text-align: left; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
	padding: 8px 14px; border-radius: 999px; border: 0;
	background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1px var(--field);
}
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; box-shadow: none; }

/* ---------- forms ---------- */
label, .label { display: block; font-weight: 600; font-size: 15px; margin: 0 0 12px; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: 14px; margin-top: 2px; }
input[type=text], input[type=email], input[type=tel], input[type=url], input[type=search], input:not([type]), textarea, select {
	display: block; width: 100%; margin-top: 5px;
	font: inherit; font-size: 17px; color: var(--ink);
	padding: 11px 12px; border: 1px solid var(--field); border-radius: 10px; background: #fff;
	-webkit-appearance: none; appearance: none;
}
select { background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%234b5060' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 12px center; padding-right: 32px; }
input:focus, textarea:focus, select:focus { outline: 3px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
textarea { resize: vertical; min-height: 84px; }
::placeholder { color: #5f6473; opacity: 1; }
[aria-invalid="true"] { border-color: var(--danger) !important; box-shadow: inset 0 0 0 1px var(--danger); }
.field-err { display: block; color: var(--danger); font-weight: 600; font-size: 14px; margin-top: 4px; }
.form-err { color: var(--danger); font-weight: 600; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; margin: 4px 0 12px; }
.check input { width: 24px; height: 24px; margin: 0; accent-color: var(--accent); flex: none; }
.repeat { display: grid; grid-template-columns: 110px 1fr 44px; gap: 8px; align-items: start; margin-bottom: 10px; }
.repeat.links { grid-template-columns: 120px 1fr 44px; }
.repeat input, .repeat select { margin-top: 0; }
.repeat .wa { grid-column: 2 / 4; margin: -2px 0 4px; font-size: 15px; }
.icon-btn { width: 44px; height: 46px; border-radius: 10px; border: 0; background: var(--bg); color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; box-shadow: inset 0 0 0 1px var(--line); }
.add { font: inherit; font-weight: 600; color: var(--link); background: none; border: 0; padding: 8px 0; cursor: pointer; }
/* The start of a card's web address, whole on its own line above the box for the end of it. */
.slug-base { display: block; margin-top: 6px; color: var(--muted); font-weight: 400; font-size: 15px; overflow-wrap: anywhere; }
.pics { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.pic { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; }
.pic .frame { width: 92px; height: 92px; border-radius: 50%; background: var(--bg); box-shadow: inset 0 0 0 1px var(--field); display: grid; place-items: center; overflow: hidden; color: var(--muted); }
.pic .frame.wide { width: 150px; border-radius: 14px; }
.pic .frame img { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; }
.pic .frame.wide img { width: auto; height: auto; aspect-ratio: auto; max-width: 100%; max-height: 100%; object-fit: contain; padding: 8px; }
.pic-btns { display: flex; gap: 6px; }
.pic-btns button { font: inherit; font-size: 14px; font-weight: 600; padding: 6px 10px; border-radius: 8px; border: 0; background: var(--bg); color: var(--ink); box-shadow: inset 0 0 0 1px var(--field); cursor: pointer; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.swatch { width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(14, 17, 22, .3); }
.swatch[aria-pressed="true"] { outline: 3px solid var(--ink); outline-offset: 2px; }
input[type=color] { width: 44px; height: 40px; border: 1px solid var(--field); border-radius: 10px; padding: 2px; background: #fff; }
.savebar { position: sticky; bottom: calc(var(--tabs-h) + 10px + env(safe-area-inset-bottom)); z-index: 4; display: flex; gap: 10px; margin-top: 14px; }
.savebar .btn { flex: 1; box-shadow: 0 6px 20px rgba(14, 17, 22, .18); }

/* ---------- share ---------- */
.mini {
	display: flex; align-items: center; gap: 12px;
	background: var(--brand, var(--accent)); color: var(--on-brand, #fff);
	border-radius: 18px 18px 0 0; padding: 14px 16px;
}
.mini img, .mini .avatar { width: 52px; height: auto; aspect-ratio: 1; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px rgba(255, 255, 255, .85); }
.mini .avatar { background: rgba(255, 255, 255, .9); color: var(--ink); }
.mini b { display: block; font-size: 18px; line-height: 1.2; }
.mini span { font-size: 15px; }
.qrwrap { background: #fff; border-radius: 0 0 18px 18px; padding: 18px 18px 14px; box-shadow: inset 0 0 0 1px var(--line); text-align: center; margin-bottom: 14px; }
.qrbtn { display: block; width: min(76vw, 300px); margin: 0 auto; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 12px; }
.qrbtn svg, .qrfull svg { display: block; width: 100%; height: auto; }
.url { font-size: 14px; color: var(--muted); margin: 10px 0 0; overflow-wrap: anywhere; }
.stat { font-size: 14px; color: var(--muted); text-align: center; }
.qrfull {
	position: fixed; inset: 0; z-index: 20; background: #fff;
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
	padding: calc(20px + env(safe-area-inset-top)) 20px calc(20px + env(safe-area-inset-bottom));
	text-align: center;
}
.qrfull .code { width: min(88vw, 70vh, 520px); }
.qrfull b { font-size: 22px; }
.qrfull .btn { min-width: 160px; }

.empty { text-align: center; padding: 30px 16px; }
.empty p { color: var(--muted); }

/* ---------- sign in ---------- */
.signin { max-width: 420px; margin: 8vh auto 0; }
.signin .logo-mark { width: 72px; max-width: 100%; height: auto; aspect-ratio: 1; border-radius: 18px; display: block; margin: 0 auto 14px; }
.signin h2 { text-align: center; }
.code-input { font: 700 30px/1 ui-monospace, Menlo, Consolas, monospace !important; letter-spacing: .3em; text-align: center; }

/* ---------- more ---------- */
.stats-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.stats-table th, .stats-table td { text-align: right; padding: 8px 4px; border-top: 1px solid var(--line); }
.stats-table th:first-child, .stats-table td:first-child { text-align: left; }
.stats-table thead th { border-top: 0; color: var(--muted); font-weight: 600; font-size: 13px; }
.sig-preview { background: #fff; border-radius: 12px; padding: 16px; box-shadow: inset 0 0 0 1px var(--line); overflow-x: auto; margin-bottom: 12px; }
/* The signature photo keeps its 76 pixels, as it will in an email; the box scrolls sideways if it must. */
.sig-preview img { max-width: none; }
canvas.preview { width: 100%; height: auto; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--line); display: block; margin-bottom: 12px; background: #fff; }
canvas.preview.tall { width: min(60%, 260px); margin: 0 auto 12px; }
.steps { padding-left: 22px; margin: 0 0 12px; }
.steps li { margin-bottom: 6px; }

@media (min-width: 700px) { main { padding-top: 24px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
