/* TapCardify app pages. Brand: docs/brand/TAPCARDIFY-BRAND-GUIDELINES.md (D-023). */
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 400; font-display: swap; src: url("/assets/fonts/plus-jakarta-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 500; font-display: swap; src: url("/assets/fonts/plus-jakarta-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 700; font-display: swap; src: url("/assets/fonts/plus-jakarta-sans-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 800; font-display: swap; src: url("/assets/fonts/plus-jakarta-sans-latin-800-normal.woff2") format("woff2"); }

:root {
  --ink: #11131F; --coral: #FF5B3A; --coral-deep: #C2381A; --paper: #F4F5F7;
  --white: #FFFFFF; --slate: #5B5F6E; --blush: #FFE7E1; --line: #E3E5EA;
}
*, *::before, *::after { box-sizing: border-box; }
/* The hidden attribute must win over component display rules (e.g. .btn's inline-flex). */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px; line-height: 1.5;
}
a { color: var(--coral-deep); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

.topbar { background: var(--white); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 760px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 12px; position: relative; }
.topbar img { height: 24px; width: auto; display: block; }
.main-nav { margin-left: auto; display: flex; gap: 14px; align-items: center; font-size: 14px; flex-wrap: wrap; }
.main-nav a { color: var(--ink); text-decoration: none; font-weight: 500; }
.main-nav a:hover { text-decoration: underline; }
.main-nav form { margin: 0; }
/* Hidden unless the menu folds (below the breakpoints): .btn, later in this file, would otherwise
   show it at every width (it did on laptops). */
.menu-toggle, .btn.menu-toggle { display: none; margin-left: auto; }
/* Admin: one line at desktop widths, renewal and failed-email badges included (D-045). */
.topbar-admin .topbar-inner { max-width: 1180px; }
.topbar-admin .main-nav { flex-wrap: nowrap; white-space: nowrap; }
/* Phones (customers) and narrow screens (admin): the menu folds behind "Menu" (menu.js). */
@media (max-width: 640px) {
  .js .topbar:not(.topbar-admin) .menu-toggle { display: inline-flex; }
  .js .topbar:not(.topbar-admin) .main-nav:not(.open) { display: none; }
  .js .topbar:not(.topbar-admin) .main-nav.open { position: absolute; top: 100%; left: 0; right: 0; z-index: 10; flex-direction: column; align-items: stretch; gap: 0; background: var(--white); border-bottom: 1px solid var(--line); padding: 4px 16px 12px; font-size: 16px; }
  .js .topbar:not(.topbar-admin) .main-nav.open > a { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .js .topbar:not(.topbar-admin) .main-nav.open form { padding-top: 12px; }
}
@media (max-width: 960px) {
  .js .topbar-admin .menu-toggle { display: inline-flex; }
  .js .topbar-admin .main-nav:not(.open) { display: none; }
  .js .topbar-admin .main-nav.open { position: absolute; top: 100%; left: 0; right: 0; z-index: 10; flex-direction: column; align-items: flex-start; gap: 0; background: var(--white); border-bottom: 1px solid var(--line); padding: 4px 16px 12px; font-size: 16px; white-space: normal; }
  .js .topbar-admin .main-nav.open > a, .js .topbar-admin .main-nav.open > span { margin: 10px 0; }
  .topbar-admin .main-nav { flex-wrap: wrap; }
}
.topbar .badge-admin { background: var(--ink); color: var(--white); font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; }

main { max-width: 760px; margin: 0 auto; padding: 24px 16px 48px; }
main.narrow { max-width: 440px; }
h1 { font-size: 24px; font-weight: 800; line-height: 1.25; margin: 8px 0 16px; }
h2 { font-size: 18px; font-weight: 700; margin: 24px 0 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--slate); font-size: 14px; }

.panel { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin-bottom: 16px; }
.status { background: var(--blush); border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; font-size: 15px; }
/* Healthy (e.g. the last backup within 26 hours): a calm green, Ink text (AA). Overdue: the warning
   tint with a Coral Deep edge. */
.status-ok { background: #E8F5EC; border-left: 4px solid #1E7A45; }
.status-warn { background: var(--blush); border-left: 4px solid var(--coral-deep); }
.error { color: var(--coral-deep); font-size: 14px; margin: 6px 0 0; font-weight: 500; }

label { display: block; font-weight: 700; font-size: 15px; margin-bottom: 6px; }
input[type=email], input[type=text], input[type=search], textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--white);
  border: 1px solid #C9CCD4; border-radius: 10px; padding: 12px 14px; min-height: 48px;
}
input:focus, textarea:focus { border-color: var(--ink); outline: none; }
textarea { min-height: 96px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--coral-deep); flex: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; border-radius: 10px; padding: 12px 20px; min-height: 48px;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
}
/* Coral buttons carry Ink labels: white on coral fails contrast (D-023). */
.btn-primary { background: var(--coral); color: var(--ink); }
.btn-primary:hover { background: #FF6F52; }
.btn:disabled, .btn:disabled:hover { opacity: .5; cursor: not-allowed; }
.btn-secondary { background: var(--white); color: var(--ink); border-color: var(--ink); }
.btn-danger { background: var(--white); color: var(--coral-deep); border-color: var(--coral-deep); }
.btn-block { width: 100%; }
.stack > * + * { margin-top: 14px; }

.code-input { font-size: 24px !important; letter-spacing: 0.3em; text-align: center; font-variant-numeric: tabular-nums; }

table.list { width: 100%; border-collapse: collapse; font-size: 15px; }
table.list th { text-align: left; font-size: 13px; color: var(--slate); font-weight: 500; padding: 8px 6px; border-bottom: 1px solid var(--line); }
table.list td { padding: 10px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--paper); border: 1px solid var(--line); }
.tag-current { background: var(--blush); border-color: var(--blush); }

@media (max-width: 560px) {
  table.list thead { display: none; }
  table.list tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
  table.list td { display: block; border: 0; padding: 2px 0; }
}

.prose h1, .prose h2, .prose h3 { line-height: 1.3; }
.prose li { margin-bottom: 6px; }
footer.site { text-align: center; color: var(--slate); font-size: 13px; padding: 0 16px 32px; }
footer.site a { color: var(--slate); }
.btn-small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
h2.flush { margin-top: 0; }
p.flush { margin: 0; }
code { font-size: 0.92em; background: var(--paper); padding: 1px 5px; border-radius: 4px; }

.card-tile, .tile { display: flex; flex-direction: column; gap: 4px; color: var(--ink); text-decoration: none; }
.card-tile:hover, .tile:hover { border-color: var(--ink); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.tiles .panel { margin-bottom: 0; }

input[type=tel], input[type=url], input[type=file] {
  width: 100%; font: inherit; color: var(--ink); background: var(--white);
  border: 1px solid #C9CCD4; border-radius: 10px; padding: 12px 14px; min-height: 48px;
}
input[type=file] { padding: 10px; }
.slot { display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: start; }
.thumb { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); }
/* An empty photo slot (admin-added, for the customer to fill): a dashed box, not a broken image. */
.thumb-empty { display: grid; place-items: center; min-height: 96px; border-style: dashed; border-color: var(--slate); color: var(--slate); font-size: 14px; font-weight: 500; }
.thumb-empty[hidden] { display: none; }
@media (max-width: 420px) { .slot { grid-template-columns: 1fr; } .thumb { width: 100%; height: auto; max-height: 180px; } }

.qr-preview { text-align: center; }
.qr-preview img { max-width: 100%; height: auto; }
h3 { font-size: 16px; font-weight: 700; margin: 0 0 4px; }
h3.flush { margin: 0; }
.photo-slot { margin-bottom: 12px; }
.photo-status { margin: 8px 0 0; font-size: 14px; color: var(--slate); min-height: 1.2em; }
.photo-status.error { color: var(--coral-deep); font-weight: 500; }
.badge-count { display: inline-block; min-width: 24px; padding: 1px 8px; border-radius: 99px; font-size: 13px; font-weight: 700; text-align: center; background: var(--paper); border: 1px solid var(--line); color: var(--ink); vertical-align: middle; text-decoration: none; }
.badge-alert { background: var(--coral-deep); border-color: var(--coral-deep); color: var(--white); }
select { width: 100%; font: inherit; color: var(--ink); background: var(--white); border: 1px solid #C9CCD4; border-radius: 10px; padding: 12px 14px; min-height: 48px; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 0; }
legend { font-weight: 700; font-size: 15px; padding: 0 4px; }
details > summary { cursor: pointer; font-weight: 700; padding: 6px 0; }
.review-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.review-actions form { margin: 0; }
td.pre { white-space: pre-line; overflow-wrap: anywhere; }
tr.ai-field td:first-child { font-weight: 700; }
.risk-flag { background: var(--coral-deep); border-color: var(--coral-deep); color: var(--white); }
.risk-check, .risk-unavailable, .risk-manual { background: var(--blush); border-color: var(--blush); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters select { width: auto; }
.pager { display: flex; gap: 16px; align-items: center; }

/* Subscription tile: clear of the tiles above it (D-045). */
#subscription { margin-top: 16px; }

/* Settings (D-045). */
.settings-section { scroll-margin-top: 16px; }

/* Photo slots (D-045): "Take photo" and "Choose from gallery" as brand buttons (coral, Ink text).
   With JavaScript the native inputs are hidden inside their labels; without it they stay visible. */
.file-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
.file-btn { margin: 0; font-size: 15px; }
.file-btn:focus-within { outline: 3px solid var(--ink); outline-offset: 2px; }
.js .file-btn input[type=file] { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; min-height: 0; }
.no-js-only { display: block; }
.js .no-js-only { display: none; }
.file-name { margin: 0 0 6px; font-size: 14px; color: var(--slate); overflow-wrap: anywhere; }
.file-pick { display: grid; gap: 6px; }
.file-pick-thumb { width: 120px; height: 90px; }
.file-pick-thumb[hidden] { display: none; }
.photo-progress { display: block; width: 100%; height: 8px; margin: 4px 0 6px; accent-color: var(--coral-deep); }
.slot-label { font-weight: 700; font-size: 15px; margin: 0 0 6px; }

/* Warnings tile (D-045). */
.warning-rule { margin: 0 0 12px; }

/* "New card" form with the live phone preview beside it (D-046). */
main.wide { max-width: 1180px; }
.designer { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 24px; align-items: start; }
.phone-preview { position: sticky; top: 16px; }
.phone-frame { display: block; width: 390px; height: 780px; margin-top: 8px; border: 10px solid var(--ink); border-radius: 32px; background: var(--white); }
@media (max-width: 960px) {
  .designer { grid-template-columns: 1fr; }
  .phone-preview { position: static; }
  .phone-frame { width: 100%; max-width: 390px; }
}
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 560px) { .two-col { grid-template-columns: 1fr; } }
.tile-row { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.tile-row summary { cursor: pointer; font-weight: 700; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 12px; }
.swatch { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.swatch input { accent-color: var(--coral-deep); }
.colour-row { display: flex; gap: 10px; align-items: center; }
.colour-row input[type=color] { width: 52px; height: 44px; padding: 2px; flex: none; }
.colour-check { display: block; width: 100%; height: 230px; border: 1px solid var(--line); border-radius: 10px; margin-top: 10px; background: var(--white); }
.colour-check-page { margin: 0; padding: 8px; background: var(--white); }
.colour-check-page img { vertical-align: middle; }
.actions-row { display: flex; flex-wrap: wrap; gap: 12px; }
