/* ============================================================
   Rascal Reviews — inspection app
   Brand: Rascal House (retro diner). Utilitarian + high-contrast
   for on-site phone use; personality in the chrome, not the data.
   ============================================================ */

@font-face {
  font-family: 'Rascal Display';
  src: url('../assets/fonts/idolwild.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'Rascal Marker';
  src: url('../assets/fonts/kg-two.ttf') format('truetype');
  font-display: swap;
}

:root {
  --paper: #fbf6ec; /* warm cream */
  --paper-2: #f3eada;
  --card: #ffffff;
  --ink: #1c1712;
  --ink-soft: #5f564a;
  --muted: #8c8375;
  --red: #d6272e;
  --red-dark: #a81e24;
  --gold: #ffca02;
  --gold-deep: #e3ae00;
  --pass: #1f9d57;
  --pass-bg: #e4f6ec;
  --fail: #d6272e;
  --fail-bg: #fbe6e6;
  --na: #8c8375;
  --na-bg: #efeae0;
  --line: #e7dcc9;
  --line-2: #d8cbb3;
  --shadow: 0 8px 24px rgba(40, 28, 12, 0.1);
  --shadow-sm: 0 2px 8px rgba(40, 28, 12, 0.08);
  --radius: 16px;
  --radius-sm: 11px;
  --tap: 46px;
  --bar-h: 58px;
  --bottom-h: 64px;
  font-synthesis-weight: none;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  font-family:
    'Cabin',
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Arial,
    sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.45;
  overflow-x: hidden; /* FOUC/overflow guard (dev-playbook) */
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(
    var(--bottom-h) + env(safe-area-inset-bottom, 0px) + 12px
  );
}
button {
  font-family: inherit;
}
input,
select,
textarea {
  font-family: inherit;
  font-size: 16px;
} /* 16px = no iOS zoom */

/* ---- App shell ---- */
.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 14px;
}

/* ---- Top bar (sticky) ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--card);
  border-bottom: 2px solid var(--ink);
  box-shadow: var(--shadow-sm);
}
.topbar .row {
  max-width: 760px;
  margin: 0 auto;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--bar-h);
}
.brandlogo {
  height: 30px;
  width: auto;
  flex: 0 0 auto;
}
.topbar .spacer {
  flex: 1;
}
.scorechip {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  padding: 6px 12px 6px 6px;
  cursor: pointer;
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-sm);
}
.scorechip .pct {
  background: var(--gold);
  color: var(--ink);
  font-weight: 800;
  border-radius: 999px;
  min-width: 44px;
  text-align: center;
  padding: 4px 8px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.scorechip .stars {
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--gold);
  white-space: nowrap;
}
.scorechip .crit {
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  border-radius: 999px;
  padding: 2px 7px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---- Section headings ---- */
.eyebrow {
  font-family: 'Rascal Marker', cursive;
  color: var(--red);
  font-size: 19px;
  line-height: 1;
  margin: 20px 2px 6px;
  transform: rotate(-1.2deg);
}
.h-display {
  font-family: 'Rascal Display', var(--ink);
  font-weight: 400;
  font-size: clamp(26px, 7vw, 38px);
  line-height: 1;
  letter-spacing: 0.01em;
  margin: 0;
}

/* ---- Cards ---- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin: 12px 0;
  overflow: hidden;
}

/* ---- Setup card ---- */
.setup {
  border-top: 5px solid var(--gold);
}
.setup .body {
  padding: 14px 15px 16px;
}
.setup h2 {
  margin: 0 0 3px;
  font-size: 18px;
}
.setup .sub {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 14px;
}
.field {
  margin: 0 0 12px;
}
.field:last-child {
  margin-bottom: 0;
}
.field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 5px;
}
.field input,
.field select {
  width: 100%;
  padding: 11px 12px;
  border: 1.5px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
}
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(214, 39, 46, 0.14);
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 460px) {
  .field-row {
    grid-template-columns: 1fr;
  }
}

/* ---- Progress ---- */
.progress {
  margin: 4px 2px 2px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--ink-soft);
}
.progress .track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--paper-2);
  overflow: hidden;
  border: 1px solid var(--line);
}
.progress .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-deep));
  border-radius: 999px;
  transition: width 0.25s ease;
}

/* ---- Area accordion ---- */
.area {
  scroll-margin-top: calc(var(--bar-h) + 10px);
}
.area > summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 15px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(180deg, #fff, #fffdf8);
}
.area > summary::-webkit-details-marker {
  display: none;
}
.area .accent {
  width: 6px;
  align-self: stretch;
  border-radius: 999px;
  background: var(--red);
  flex: 0 0 auto;
  margin: -2px 0;
}
.area .a-title {
  min-width: 0;
  flex: 1;
}
.area .a-title .name {
  font-weight: 700;
  font-size: 15.5px;
  line-height: 1.2;
}
.area .a-title .meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.subtotal {
  font-weight: 800;
  font-size: 13px;
  border-radius: 999px;
  padding: 5px 10px;
  white-space: nowrap;
  background: var(--paper-2);
  color: var(--ink);
  border: 1px solid var(--line-2);
  font-variant-numeric: tabular-nums;
}
.subtotal.good {
  background: var(--pass-bg);
  color: #137a41;
  border-color: #bfe6cf;
}
.subtotal.warn {
  background: var(--fail-bg);
  color: var(--red-dark);
  border-color: #f2c9c9;
}
.crit-badge {
  background: var(--red);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 999px;
  padding: 3px 7px;
  margin-left: 6px;
}
.chev {
  flex: 0 0 auto;
  color: var(--muted);
  transition: transform 0.2s ease;
}
.area[open] .chev {
  transform: rotate(90deg);
}
.area .a-body {
  padding: 2px 13px 14px;
  border-top: 1px solid var(--line);
}
.subgroup {
  font-family: 'Rascal Marker', cursive;
  color: var(--red-dark);
  font-size: 16px;
  margin: 14px 4px 4px;
  transform: rotate(-0.6deg);
}

/* ---- Line item ---- */
.item {
  padding: 12px 2px;
  border-bottom: 1px dashed var(--line-2);
}
.item:last-child {
  border-bottom: none;
}
.item.item-fail {
  background: linear-gradient(90deg, rgba(214, 39, 46, 0.05), transparent);
  border-radius: 10px;
  padding-left: 8px;
}
.item .qtext {
  font-size: 14.5px;
  line-height: 1.35;
  margin-bottom: 9px;
}
.item .flagdot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  margin-right: 6px;
  vertical-align: 1px;
}
.seg {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 7px;
}
.seg button {
  min-height: var(--tap);
  border: 1.5px solid var(--line-2);
  background: #fff;
  color: var(--ink-soft);
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.seg button:active {
  transform: translateY(1px);
}
.seg button .ic {
  font-size: 15px;
  line-height: 1;
}
.seg button[aria-pressed='true'][data-v='pass'] {
  background: var(--pass);
  border-color: var(--pass);
  color: #fff;
}
.seg button[aria-pressed='true'][data-v='fail'] {
  background: var(--fail);
  border-color: var(--fail);
  color: #fff;
}
.seg button[aria-pressed='true'][data-v='na'] {
  background: var(--na);
  border-color: var(--na);
  color: #fff;
}

/* item tools row (note + photo) */
.tools {
  display: flex;
  gap: 8px;
  margin-top: 9px;
  flex-wrap: wrap;
}
.toolbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-soft);
  background: var(--paper-2);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 6px 11px;
  cursor: pointer;
}
.toolbtn.on {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.toolbtn .ic {
  font-size: 14px;
}
.note {
  margin-top: 9px;
}
.note textarea {
  width: 100%;
  min-height: 60px;
  padding: 10px 11px;
  border: 1.5px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: #fffdf6;
  resize: vertical;
}
.note textarea:focus {
  outline: none;
  border-color: var(--gold-deep);
  box-shadow: 0 0 0 3px rgba(255, 202, 2, 0.22);
}
.thumbs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 9px;
}
.thumb {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--line-2);
  background: #000;
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.thumb .x {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  border: 2px solid #fff;
  font-size: 13px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.hiddenfile {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ---- product grid (matrix -> per-item cards on mobile) ---- */
.griditem {
  padding: 12px 2px;
  border-bottom: 1px dashed var(--line-2);
}
.griditem:last-child {
  border-bottom: none;
}
.griditem .gname {
  font-weight: 700;
  font-size: 14.5px;
  margin-bottom: 9px;
}
.critrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px dotted var(--line);
}
.critrow:first-of-type {
  border-top: none;
}
.critrow .clabel {
  font-size: 13.5px;
  color: var(--ink-soft);
  min-width: 0;
  flex: 1;
}
.mini {
  display: grid;
  grid-template-columns: repeat(3, 42px);
  gap: 6px;
  flex: 0 0 auto;
}
.mini button {
  min-height: 38px;
  border: 1.5px solid var(--line-2);
  background: #fff;
  border-radius: 9px;
  font-weight: 800;
  font-size: 12px;
  color: var(--ink-soft);
  cursor: pointer;
}
.mini button[aria-pressed='true'][data-v='pass'] {
  background: var(--pass);
  border-color: var(--pass);
  color: #fff;
}
.mini button[aria-pressed='true'][data-v='fail'] {
  background: var(--fail);
  border-color: var(--fail);
  color: #fff;
}
.mini button[aria-pressed='true'][data-v='na'] {
  background: var(--na);
  border-color: var(--na);
  color: #fff;
}

/* ---- Bottom action bar ---- */
.bottombar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  background: var(--card);
  border-top: 2px solid var(--ink);
  padding: 8px 14px calc(8px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -6px 20px rgba(40, 28, 12, 0.1);
}
.bottombar .row {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.bottombar .stat {
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.15;
}
.bottombar .stat b {
  font-size: 16px;
  color: var(--ink);
  display: block;
  font-variant-numeric: tabular-nums;
}
.btn {
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn.primary {
  background: var(--red);
  color: #fff;
  box-shadow: 0 4px 0 var(--red-dark);
}
.btn.primary:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--red-dark);
}
.btn.ghost {
  background: var(--paper-2);
  color: var(--ink);
  border: 1.5px solid var(--line-2);
}
.bottombar .grow {
  flex: 1;
}

/* ---- Summary sheet ---- */
.result-banner {
  border-radius: var(--radius);
  padding: 18px 16px;
  margin: 12px 0;
  color: #fff;
  text-align: center;
  box-shadow: var(--shadow);
}
.result-banner.pass {
  background: linear-gradient(135deg, #1f9d57, #137a41);
}
.result-banner.warn {
  background: linear-gradient(135deg, #e3ae00, #b98a00);
}
.result-banner.fail {
  background: linear-gradient(135deg, var(--red), var(--red-dark));
}
.result-banner .big {
  font-family: 'Rascal Display';
  font-size: 46px;
  line-height: 1;
}
.result-banner .stars {
  font-size: 24px;
  letter-spacing: 3px;
  margin-top: 4px;
}
.result-banner .label {
  font-weight: 700;
  margin-top: 6px;
  opacity: 0.95;
}
.kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 12px 0;
}
.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}
.kpi .v {
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.kpi .l {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}
.crit-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.crit-list li {
  padding: 10px 12px;
  border: 1px solid #f2c9c9;
  background: var(--fail-bg);
  border-radius: 10px;
  margin-bottom: 8px;
  font-size: 13.5px;
}
.crit-list li b {
  color: var(--red-dark);
}

.hide {
  display: none !important;
}
.center {
  text-align: center;
}
.tiny {
  font-size: 12px;
  color: var(--muted);
}

/* remove-before-launch dev ribbon */
.devnote {
  margin: 16px 2px 4px;
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
}

/* report generation actions (summary view) */
.report-actions {
  margin: 18px 0 6px;
}
.btn-block {
  width: 100%;
}
.report-out {
  margin-top: 12px;
}
.report-link {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.report-link a {
  color: var(--red-dark);
  word-break: break-all;
  font-size: 13px;
  font-weight: 600;
}

/* test-mode banner (short page only) */
.testbanner {
  background: repeating-linear-gradient(
    45deg,
    var(--ink),
    var(--ink) 10px,
    #2a2119 10px,
    #2a2119 20px
  );
  color: var(--gold);
  text-align: center;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-bottom: 2px solid var(--gold);
}
