:root {
  --ink: #1f2430;
  --muted: #6b7280;
  --line: #e7eaf0;
  --bg: #f1f4f8;
  --card: #ffffff;
  --danger: #d92d20;
  --ok: #5cc8a8;
  --gold: #f5b301;
  --brand: #0b6ea8;      /* admin primary */
  --accent: #00b8f0;     /* survey buttons, overridden per survey */
  --dark: #31353c;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--brand); }
h1 { font-size: 1.55rem; line-height: 1.25; margin: 0 0 .6rem; font-weight: 700; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
p { margin: 0 0 .7rem; }
hr { border: 0; border-top: 1px solid #d9dde3; margin: 1.3rem 0; }
i { color: var(--accent); font-style: normal; }
.center { text-align: center; }
.strong { font-weight: 700; }
.muted { color: var(--muted); font-weight: normal; }
.small { font-size: .8rem; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }
.error { display: block; color: var(--danger); font-size: .85rem; margin-top: .3rem; }
.banner { background: #fff4d6; border-bottom: 1px solid #f0d98a; padding: .55rem 1rem; font-size: .85rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 1.4rem; }

label { display: block; margin: 0 0 1rem; font-weight: 600; font-size: .92rem; }
label small { display: block; font-weight: normal; color: var(--muted); margin-top: .3rem; }
input, select, textarea {
  display: block; width: 100%; margin-top: .35rem; padding: .75rem .85rem;
  font: inherit; font-weight: normal; color: inherit;
  border: 1px solid #ccd3dd; border-radius: 10px; background: #fff;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
input[type=color] { height: 2.8rem; padding: .25rem; width: 6rem; }
label.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: normal; flex-wrap: wrap; }
label.check input { width: auto; margin: .25rem 0 0; }
label.check > span { flex: 1; }
label.check small, label.check .error { flex-basis: 100%; margin-left: 1.6rem; }

.btn {
  display: inline-block; border: 0; border-radius: 8px; padding: .7rem 1.2rem; cursor: pointer;
  font: inherit; font-weight: 600; text-decoration: none; text-align: center; line-height: 1.2;
}
.btn.primary { background: var(--brand); color: #fff; }
.btn.outline { background: #fff; color: var(--ink); border: 1px solid #cfd5de; font-weight: 500; }
.btn.small { padding: .3rem .6rem; font-size: .8rem; }
.btn.wide { width: 100%; }
button.link { background: none; border: 0; color: var(--brand); padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }
button.link.danger { color: var(--danger); }

/* ---------- Customer survey: phone first ---------- */
.public { background: #f6f7f9; }
.public .page { max-width: 640px; margin: 0 auto; padding: 1.2rem 16px 2rem; }
.public .card { border: 0; box-shadow: 0 2px 14px rgba(20, 30, 50, .07); padding: 1.8rem 1.4rem; }
@media (min-width: 600px) { .public .card { padding: 2.2rem 2.4rem; } }
.public h1 { font-size: 1.6rem; }
.public h1.light { font-weight: 300; font-size: 1.55rem; }
.public h1.light strong { font-weight: 700; display: inline-block; margin-top: .2rem; }
.public h1.big { font-size: 2rem; }
.sub { font-size: .95rem; }
.step { text-align: center; font-size: .85rem; margin-bottom: 1rem; }
.panel { background: #f8f9fa; border-radius: 14px; padding: 1.3rem 1.1rem; margin-top: 1rem; }
.product-img { width: 190px; height: 190px; object-fit: contain; border-radius: 12px; border: 1px solid #d5d9de; background: #fff; margin: .2rem auto 1rem; display: block; }
.product-img.small { width: 160px; height: 160px; }
.pill { display: inline-block; background: #111; color: #fff; font-weight: 700; padding: .45rem 1.1rem; border-radius: 99px; font-size: .95rem; }
.soft-btn {
  display: inline-block; background: #ddeefe; color: #13223a; border: 0; border-radius: 8px;
  padding: .75rem 1.3rem; font: inherit; font-weight: 600; font-size: .9rem; text-decoration: none; cursor: pointer; margin: .3rem 0 1.4rem;
}
.soft-btn.muted-btn { background: #eceef1; color: #6b7280; }
.float { position: relative; text-align: left; margin-top: .6rem; }
.float input { margin-top: 0; padding: 1rem .9rem .8rem; }
.float-label {
  position: absolute; top: -.65rem; left: .7rem; z-index: 1; background: #e6ecf5; color: #1f2430;
  padding: .05rem .55rem; border-radius: 6px; font-size: .8rem; font-weight: 600;
}
.float small { text-align: center; }
.two-col { display: grid; gap: 0 1rem; }
@media (min-width: 520px) { .two-col { grid-template-columns: 1fr 1fr; } }
.public form .float + .float, .two-col + .float { margin-top: 1.1rem; }
.two-col .float { margin-bottom: 1.1rem; }

.nav-row { display: flex; justify-content: space-between; align-items: center; margin-top: 1.6rem; }
.nav-row .btn { min-width: 7.5rem; padding: .95rem 1.4rem; }
.btn.next { background: var(--accent); color: #fff; }
.btn.next:disabled { background: #eef0f2; color: #9aa1aa; cursor: not-allowed; }
.btn.back { background: var(--dark); color: #fff; }

.rating { border: 0; padding: 0; margin: 0 0 1.4rem; }
.rating legend { width: 100%; margin-bottom: .4rem; }
.stars { position: relative; display: inline-flex; flex-direction: row-reverse; gap: .2rem; }
/* Hidden radios, kept for keyboards and screen readers. They must never catch a tap:
   phones widen touch targets, and these all sit in one spot next to the 5th star. */
.stars input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; clip-path: inset(50%); }
.stars label {
  margin: 0; font-size: 2.7rem; line-height: 1; cursor: pointer;
  color: transparent; -webkit-text-stroke: 2px var(--accent);
}
.stars input:checked ~ label, .stars label:hover, .stars label:hover ~ label { color: var(--accent); }
.stars input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.review-q { font-weight: 700; line-height: 1.45; }
.review-q textarea { margin-top: .9rem; text-align: left; }
.counter { text-align: right; font-size: .78rem; font-style: italic; font-weight: 700; color: var(--accent); margin: -.6rem 0 .2rem; }
.counter.ok { color: var(--ok); }
.required-note { text-align: right; font-size: .85rem; }
.fine { font-size: .78rem; color: var(--muted); margin-top: .6rem; }
.thumb { color: #111; margin-bottom: .6rem; }
.review-ask h2 { color: var(--accent); font-size: 1.2rem; }
.box { border: 1px solid #d5d9de; border-radius: 10px; margin-top: 1.2rem; overflow: hidden; }
.box-head { background: #f6f7f9; border-bottom: 1px solid #d5d9de; padding: .9rem; font-weight: 700; }
.box-body { padding: 1.1rem 1rem .2rem; }
.copy-text { white-space: pre-wrap; text-align: left; max-height: 12rem; overflow: auto; }
.box .soft-btn { margin: .4rem 0 1rem; }
.foot { text-align: center; font-size: .82rem; color: var(--muted); margin-top: 1.2rem; }
.foot p { margin: .2rem 0; }
.prose h2 { margin-top: 1.2rem; }

/* ---------- Admin ---------- */
.shell { display: flex; min-height: 100vh; }
.side { width: 210px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--line); padding: 1rem .6rem; display: flex; flex-direction: column; }
.logo { display: flex; align-items: center; gap: .45rem; font-weight: 800; letter-spacing: .02em; color: var(--ink); text-decoration: none; padding: 0 .5rem 1.2rem; font-size: 1.05rem; }
.logo.center { justify-content: center; }
.logo-mark { display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: #2a9df4; color: #fff; }
.logo-mark .icon { width: 1rem; height: 1rem; fill: #fff; stroke: #fff; }
.side-h { font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--brand); padding: 1rem .5rem .4rem; }
.side a:not(.logo), .side button.link { display: flex; align-items: center; gap: .6rem; padding: .5rem; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: .85rem; }
.side a.active { background: #eaf3fb; color: var(--brand); font-weight: 600; }
.side a:not(.logo):hover { background: #f3f6fa; }
.side-foot { margin-top: auto; }
.side button.link { width: 100%; color: var(--muted); }
.icon { width: 1.15rem; height: 1.15rem; flex-shrink: 0; }
.icon.ok { color: var(--ok); }
.icon.bad { color: var(--danger); }
.content { flex: 1; min-width: 0; }
.admin .wrap { padding: 1.6rem 1.6rem 3rem; max-width: 1500px; }
@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .side { width: auto; flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); padding: .5rem 16px; }
  .side-h { display: none; }
  .logo { padding: 0 .5rem 0 0; }
  .side-foot { margin: 0 0 0 auto; }
  .side button.link { width: auto; }
  .admin .wrap { padding: 1.2rem 16px 2rem; }
}
.page-title { font-size: 1.45rem; font-weight: 600; display: flex; align-items: center; gap: .4rem; margin: 0; }
.narrow { max-width: 360px; margin: 4rem auto; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.actions { display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; }
.actions.center { justify-content: center; }
.accent { color: #2ab7a9; }

.table-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; margin-bottom: 1.4rem; }
table { width: 100%; border-collapse: collapse; font-size: .82rem; }
th, td { text-align: left; padding: .85rem 1rem; border-bottom: 1px solid #eef0f4; vertical-align: middle; }
th { font-weight: 600; white-space: nowrap; color: #111827; background: #f9fafb; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.c, th.c { text-align: center; }
.nowrap { white-space: nowrap; }
tr.paused td { color: var(--muted); }
table.plain td { padding: .5rem 0; border-bottom: 1px solid #f0f2f5; font-size: .88rem; }
.icon-btn { display: inline-grid; place-items: center; background: none; border: 0; padding: .3rem; color: var(--ink); cursor: pointer; border-radius: 6px; }
.icon-btn:hover { background: #f1f4f8; }
.icon-btn .icon { width: 1.4rem; height: 1.4rem; }
.icon-btn.live { color: var(--ok); }
.page-title .icon-btn { color: var(--brand); }
.code { color: #e5484d; background: #fff; border: 1px solid #f1d6d6; border-radius: 4px; padding: .15rem .45rem; font-size: .82rem; }
.stars-view span { color: #d6d9de; font-size: 1rem; letter-spacing: .05em; }
.stars-view span.on { color: var(--gold); }
table.reviews { min-width: 1300px; }
table.reviews td { white-space: nowrap; }
.review-cell { width: 280px; }
.review-cell details { width: 280px; }
.review-cell summary { cursor: pointer; list-style: none; overflow: hidden; text-overflow: ellipsis; }
.review-cell summary::-webkit-details-marker { display: none; }
.review-cell details[open] summary { color: var(--muted); }
.review-cell details p { white-space: pre-wrap; margin: .5rem 0 0; }
.pill-tag { display: inline-block; font-size: .65rem; font-weight: 700; padding: .05rem .4rem; border-radius: 4px; background: #fde7c7; color: #8a5300; vertical-align: middle; }
.pill-tag.ok { background: #dff5ee; color: #1b7a5c; }
.pill-tag.bad { background: #fdecec; color: #9b1c1c; }
.sent { color: #1b7a5c; }
.filter { max-width: 320px; margin-bottom: 1rem; }
.info { display: flex; padding: 1.1rem 1.4rem; }

.kpis { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin: 1.2rem 0 1.4rem; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.1rem; text-decoration: none; color: var(--ink); }
.kpi span { display: block; font-size: .78rem; color: var(--muted); }
.kpi strong { font-size: 1.6rem; font-weight: 700; }
a.kpi[href]:hover { border-color: var(--brand); }
.grid-2 { display: grid; gap: 1.2rem; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.dist { display: grid; grid-template-columns: 2.5rem 1fr 2.5rem; align-items: center; gap: .6rem; margin: .45rem 0; font-size: .88rem; }
.dist .bar { background: #f0f2f5; border-radius: 99px; height: .6rem; overflow: hidden; }
.dist .bar div { background: var(--gold); height: 100%; }
.dist .num { text-align: right; }

.product-form fieldset { margin: 0 0 1.2rem; }
/* Floating the legend keeps the section title inside the white card instead of on its border. */
.product-form legend { float: left; width: 100%; grid-column: 1 / -1; font-size: 1.05rem; font-weight: 700;
  padding: 0 0 .7rem; margin: 0 0 1rem; border-bottom: 1px solid var(--line); }
.product-form legend + * { clear: both; }
@media (min-width: 900px) {
  .product-form fieldset { display: grid; grid-template-columns: 1fr 1fr; column-gap: 1.5rem; }
  .product-form fieldset > label:has(textarea) { grid-column: 1 / -1; }
}
.qr-grid { display: grid; gap: 1.2rem; grid-template-columns: 1fr; }
@media (min-width: 900px) { .qr-grid { grid-template-columns: 1.2fr 1fr; } }
.qr { width: 100%; max-width: 340px; height: auto; image-rendering: pixelated; }
.qr-grid .mono { word-break: break-all; }

/* Survey image upload */
.image-field { margin: 0 0 1rem; }
.image-field .label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .4rem; }
.image-row { display: flex; gap: 1.2rem; align-items: flex-start; flex-wrap: wrap; }
.image-preview { width: 160px; height: 160px; border: 1px solid #dde2ea; border-radius: 10px; background: #fff; display: grid; place-items: center; overflow: hidden; flex: none; }
.image-preview img { width: 100%; height: 100%; object-fit: contain; }
.image-preview span { color: var(--muted); font-size: .85rem; }
.image-controls { flex: 1; min-width: 240px; }
.image-controls small { display: block; color: var(--muted); margin-top: .35rem; font-size: .82rem; }
.file-btn { display: inline-block; margin: 0; cursor: pointer; }
.image-note { margin: .5rem 0 0; font-size: .85rem; min-height: 1em; }
.image-note.ok { color: #1a7f37; }
.image-note.warn { color: #9a6700; }
.image-note.bad { color: #c62828; }
.image-controls details { margin-top: .8rem; font-size: .88rem; }
.image-controls summary { cursor: pointer; color: var(--muted); }
.image-controls details input { margin-top: .5rem; }
.file-btn input[type=file] { display: none; }

/* Step 2 optional questions */
.extras { margin-top: 1.4rem; }
.extra { border-top: 1px solid #eceef1; padding: 1.1rem 0; text-align: center; }
.extra .rating { margin: 0; }
.extra .stars label { font-size: 2.3rem; }
.extra legend, .extra > .strong { margin: 0 0 .5rem; }
.extra:last-child { padding-bottom: 0; }
.optional { font-weight: normal; font-size: .78rem; color: var(--muted); margin-left: .2rem; }
.extra .float { text-align: left; font-weight: normal; }
.answers { display: grid; grid-template-columns: auto auto; justify-content: start; gap: .2rem .8rem; margin: .6rem 0 0; font-size: .85rem; }
.answers dt { color: var(--muted); white-space: normal; }
.answers dd { margin: 0; }
.review-cell .pill-tag { font-size: .7rem; }

/* QR page redirect check */
.check { border-radius: 10px; padding: .8rem 1rem; margin: 0 0 1.2rem; font-size: .9rem; border: 1px solid; }
.check.ok { background: #eaf7ee; border-color: #b5e2c2; color: #14532d; }
.check.warn { background: #fff8e6; border-color: #f2d48a; color: #6b4e00; }
.check.bad { background: #fdecec; border-color: #f3b9b9; color: #7f1d1d; }
.check .mono { word-break: break-all; }

/* Survey web address: fixed server part shown in front of the editable end */
.prefixed { display: flex; align-items: stretch; margin-top: .4rem; }
.prefixed > span { display: flex; align-items: center; padding: 0 .7rem; background: #f1f4f8; border: 1px solid #ccd3dd; border-right: 0; border-radius: 10px 0 0 10px; color: var(--muted); font-weight: normal; white-space: nowrap; font-size: .88rem; }
.prefixed input { margin-top: 0; border-radius: 0 10px 10px 0; min-width: 0; }

/* Login, 2FA and account pages */
.auth .auth-h { font-size: 1.15rem; margin: 0 0 .5rem; }
.auth form { margin: .8rem 0; }
.auth details { margin: .6rem 0; }
.auth .btn + .btn { margin-top: .5rem; }
.auth a.btn { display: block; text-align: center; }
.notice { background: #eaf7ee; border: 1px solid #b5e2c2; color: #14532d; border-radius: 10px; padding: .6rem .8rem; font-size: .85rem; }
.code-input { font-size: 1.4rem; letter-spacing: .3em; text-align: center; font-family: ui-monospace, Consolas, monospace; }
.totp-qr { display: block; width: 220px; height: 220px; margin: .8rem auto; image-rendering: pixelated; }
.secret { font-size: 1rem; letter-spacing: .05em; word-break: break-all; }
.backup-codes { columns: 2; padding-left: 1.6rem; margin: 1rem 0; font-size: 1rem; line-height: 1.9; }
.side-me { font-size: .8rem; padding: .3rem .5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-me span { display: block; color: var(--muted); font-size: .7rem; text-transform: capitalize; }
form.inline { display: inline; margin: 0; }
.copy-row { display: flex; gap: .5rem; }
.copy-row input { flex: 1; }
.info p { margin: 0 0 .6rem; }
.card.info:has(.copy-row) { display: block; margin-bottom: 1.2rem; }
@media (max-width: 760px) { .side-me { display: none; } }
form.inline select { width: auto; padding: .3rem .5rem; margin: 0; }
form.inline + form.inline { margin-left: .7rem; }
