/* =====================================================
   LDS OPA CRM — stylesheet
   Clean white theme. LDS pink accent (#EEA3C1).
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;500;600;700;800&display=swap');

:root {
  --ink:        #0B0C0E;
  --ink-2:      #1A1C20;
  --ink-3:      #3A3D42;

  --paper:      #FFFFFF;
  --canvas:     #FAFAFB;
  --hairline:   #ECECEE;
  --line:       #E1E1E4;
  --line-soft:  #F0F0F2;
  --fill:       #F5F5F7;
  --fill-2:     #EDEDEF;
  --mute:       #6C6D72;
  --mute-2:     #9B9CA1;

  --pink:       #EEA3C1;   /* LDS brand pink — sampled from logo */
  --pink-soft:  #FDF2F6;
  --pink-2:     #F7BFD2;
  --pink-dk:    #D67FA4;
  --pink-ink:   #8C3E5E;   /* legible text on pink-soft backgrounds */

  --good:       #2F7D4F;
  --good-soft:  #EFF8F2;
  --bad:        #C0392B;
  --bad-soft:   #FDF2F0;
  --warn:       #B97A14;
  --warn-soft:  #FBF5E8;
  --gold:       #C9A24A;
  --blue:       #2C6FD1;
  --blue-soft:  #EEF3FC;

  /* Single font family — Manrope for everything.
     --display used where we previously had --serif (heavier weight / tighter tracking). */
  --display:  'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --sans:     'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  /* Back-compat alias — old stylesheet referenced var(--serif) in many places */
  --serif:    var(--display);

  --r-sm: 6px;
  --r:    10px;
  --r-lg: 14px;
  --r-xl: 22px;

  --shadow-1: 0 1px 2px rgba(15,17,22,.04), 0 1px 3px rgba(15,17,22,.03);
  --shadow-2: 0 6px 22px rgba(15,17,22,.08), 0 2px 6px rgba(15,17,22,.04);
  --shadow-pink: 0 2px 10px rgba(238,163,193,.28);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  background: var(--canvas);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding-bottom: 100px;
  overflow-x: hidden;
}
/* iOS: keep input font-size >= 16px to prevent zoom-on-focus */
input, select, textarea {
  font-size: 16px;
}
@media (min-width: 768px) {
  input, select, textarea { font-size: 15px; }
}
/* Remove native spinners on number inputs */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* ============== TYPOGRAPHY ============== */
h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 0;
  color: var(--ink);
}
h1 { font-size: 34px; line-height: 1.05; font-weight: 800; letter-spacing: -0.035em; }
h2 { font-size: 22px; line-height: 1.15; letter-spacing: -0.025em; }
h3 { font-size: 17px; line-height: 1.25; letter-spacing: -0.015em; }
@media (max-width: 520px) {
  h1 { font-size: 28px; letter-spacing: -0.03em; }
  h2 { font-size: 20px; }
}
.eyebrow {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 700;
}
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ============== TOPBAR ============== */
/* =====================================================
   V2 ELITE — TOPBAR
   Big logo, glass backdrop, proper identity badge on the right.
   ===================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: linear-gradient(180deg, rgba(255,255,255,0.92) 0%, rgba(253,240,245,0.85) 100%);
  border-bottom: 1px solid rgba(238, 163, 193, 0.25);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset,
              0 4px 20px rgba(199, 110, 146, 0.06);
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  color: var(--ink);
  min-width: 0;
}
.topbar .brand img {
  height: 52px;
  width: auto;
  display: block;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 8px rgba(199,110,146,0.15));
  transition: transform .2s cubic-bezier(.2,.8,.2,1);
}
.topbar .brand:hover img { transform: scale(1.03); }
.topbar .brand .pipe {
  width: 1px;
  height: 28px;
  background: linear-gradient(180deg, transparent 0%, rgba(199,110,146,0.4) 50%, transparent 100%);
  flex-shrink: 0;
  display: block;
}
.topbar .brand .subtitle {
  font-size: 11px;
  color: var(--pink-ink, #8B3F5F);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 700;
  white-space: nowrap;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

@media (max-width: 640px) {
  .topbar { padding: 10px 14px; }
  .topbar .brand img { height: 40px; }
  .topbar .brand .pipe, .topbar .brand .subtitle { display: none; }
  .topbar-actions { gap: 6px; }
  .topbar-new-audit {
    padding: 8px 12px !important;
    font-size: 12px !important;
  }
}

/* Identity badge (lives inside .topbar-actions, NOT floating) */
.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 6px 5px 8px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(238, 163, 193, 0.35);
  border-radius: 100px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 10px rgba(199, 110, 146, 0.08),
              inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: all .18s ease;
}
.user-badge:empty { display: none; }
.user-badge:hover {
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 16px rgba(199, 110, 146, 0.12),
              inset 0 1px 0 rgba(255, 255, 255, 1);
}
.user-badge .ub-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, #EEA3C1 0%, #C76E92 100%);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(199, 110, 146, 0.35),
              inset 0 1px 0 rgba(255, 255, 255, 0.25);
  font-family: var(--display, 'Playfair Display'), serif;
  letter-spacing: -0.02em;
}
.user-badge .ub-info {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
  padding-right: 4px;
}
.user-badge .ub-name {
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  letter-spacing: -0.01em;
}
.user-badge .ub-role {
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--pink-ink, #8B3F5F);
}
.user-badge .ub-logout {
  width: 30px; height: 30px;
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: var(--mute);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s ease;
  flex-shrink: 0;
}
.user-badge .ub-logout:hover {
  background: rgba(183, 45, 59, 0.1);
  color: var(--bad);
}

@media (max-width: 680px) {
  .user-badge .ub-info { display: none; }
  .user-badge { padding: 3px; }
}

/* Legacy float — now suppressed; badge lives in topbar */
.user-badge-float { display: none !important; }

/* ============== NAV TABS — elite pill style ============== */
.nav-tabs {
  background: rgba(255, 255, 255, 0.65);
  border-bottom: 1px solid rgba(238, 163, 193, 0.2);
  padding: 8px 24px;
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  position: sticky;
  top: 82px;
  z-index: 30;
  gap: 2px;
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
}
.nav-tabs::-webkit-scrollbar { display: none; }
.nav-tabs a {
  flex: 0 0 auto;
  padding: 9px 16px;
  color: var(--mute);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: 100px;
  white-space: nowrap;
  transition: all .18s cubic-bezier(.2,.8,.2,1);
  border: 1px solid transparent;
}
.nav-tabs a:hover {
  color: var(--ink);
  background: rgba(238, 163, 193, 0.12);
}
.nav-tabs a.active {
  color: var(--ink);
  background: #fff;
  border-color: rgba(238, 163, 193, 0.4);
  box-shadow: 0 2px 8px rgba(199, 110, 146, 0.12);
}

@media (max-width: 640px) {
  .nav-tabs { padding: 6px 12px; top: 62px; }
  .nav-tabs a { padding: 8px 12px; font-size: 12px; }
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 32px 40px;
}
@media (max-width: 640px) {
  .container { padding: 20px 16px 24px; }
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-header h1 { flex: 1 1 auto; }
.page-header .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============== CARDS ============== */
.card {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 22px;
  box-shadow: var(--shadow-1);
}
.card + .card { margin-top: 14px; }
.card h2 + p, .card h3 + p { color: var(--mute); margin-top: 4px; }

/* ============== BUTTONS ============== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--r);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform .08s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease, color .15s ease;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  line-height: 1;
  user-select: none;
  min-height: 44px;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.btn-primary:hover { background: var(--ink-2); }
.btn-accent {
  background: var(--pink);
  color: #5a2038;
  border-color: var(--pink);
  box-shadow: var(--shadow-pink);
}
.btn-accent:hover { background: var(--pink-dk); color: #fff; border-color: var(--pink-dk); }
.btn-outline {
  background: var(--paper);
  border-color: var(--line);
  color: var(--ink);
}
.btn-outline:hover { border-color: var(--ink); background: var(--fill); }
.btn-ghost { border-color: transparent; color: var(--ink); background: transparent; }
.btn-ghost:hover { background: var(--fill); }
.btn-danger {
  border-color: var(--bad);
  color: var(--bad);
  background: var(--paper);
}
.btn-danger:hover { background: var(--bad); color: #fff; }
.btn-sm { padding: 7px 12px; min-height: 34px; font-size: 13px; }
.btn-lg { padding: 14px 24px; min-height: 52px; font-size: 15px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .4; cursor: not-allowed; }

/* ============== FORM ============== */
label.field {
  display: block;
  margin-bottom: 14px;
}
label.field > span {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mute);
  margin-bottom: 6px;
}
input[type=text], input[type=date], input[type=tel], input[type=number], input[type=email], select, textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
  background: var(--paper);
  transition: border-color .15s ease, box-shadow .15s ease;
  line-height: 1.3;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(238,163,193,0.25);
}
textarea { resize: vertical; min-height: 80px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .field-row { grid-template-columns: 1fr; } }

/* ============== DASHBOARD STATS ============== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-1);
}
.stat .label {
  font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mute); font-weight: 600;
  margin-bottom: 8px;
}
.stat .value {
  font-family: var(--display);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1;
}
.stat .value .small { font-size: 16px; color: var(--mute); font-weight: 600; letter-spacing: -0.02em; }
.stat .hint { color: var(--mute); font-size: 12px; margin-top: 6px; }

/* ============== STORE LIST ============== */
.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.store-card {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color .15s ease, box-shadow .15s ease, transform .1s ease;
  position: relative;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow-1);
}
.store-card:hover { border-color: var(--pink); box-shadow: var(--shadow-2); }
.store-card .code {
  font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pink-dk); font-weight: 700;
}
.store-card .name {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.1;
}
.store-card .meta {
  font-size: 13px;
  color: var(--mute);
  line-height: 1.4;
}
.store-card .last-audit {
  padding-top: 10px;
  margin-top: auto;
  border-top: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: var(--mute);
}
.store-card .last-audit .stars {
  font-family: var(--serif);
  font-weight: 600;
}

/* ============== CATEGORY TABS (audit form) ============== */
.cat-tabs {
  display: flex;
  gap: 6px;
  padding: 6px;
  background: var(--fill);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: 18px;
}
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tabs button {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  padding: 10px 14px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--mute);
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
  letter-spacing: 0.005em;
}
.cat-tabs button .pct {
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 500;
  margin-left: 6px;
  color: var(--mute);
}
.cat-tabs button.active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}
.cat-tabs button.active .pct { color: var(--pink-dk); font-weight: 600; }
.cat-tabs button:hover:not(.active) { color: var(--ink); }

/* ============== ITEM ROWS ============== */
.items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.item {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
  transition: border-color .15s ease, background .15s ease;
}
.item.is-yes { border-color: rgba(47,125,79,0.3); background: var(--good-soft); }
.item.is-no  { border-color: rgba(192,57,43,0.3); background: var(--bad-soft); }
.item.critical .points-badge { background: var(--pink); color: #5a2038; border-color: var(--pink); }
.points-badge {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--fill);
  color: var(--ink);
  border: 1px solid var(--hairline);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.item-text {
  font-size: 14px;
  line-height: 1.35;
}
.item-text .tag-crit {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--pink);
  color: #5a2038;
  vertical-align: 2px;
}
.item-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}
.yn {
  display: inline-flex;
  background: var(--fill);
  border-radius: 8px;
  padding: 2px;
  border: 1px solid var(--hairline);
}
.yn button {
  border: none;
  background: transparent;
  padding: 7px 12px;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 13px;
  color: var(--mute);
  cursor: pointer;
  border-radius: 6px;
  min-width: 38px;
  min-height: 32px;
  letter-spacing: 0.04em;
}
.yn button.y.active { background: var(--good); color: #fff; }
.yn button.n.active { background: var(--bad);  color: #fff; }
.item-meta-row {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  margin-top: 4px;
}
.item-meta-row.hidden { display: none; }
.item-meta-row input[type=text] {
  flex: 1 1 auto;
  padding: 8px 10px;
  font-size: 13px;
}
.photo-btn {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
}
.photo-btn:hover { border-color: var(--pink); color: var(--pink-dk); }
.photo-btn.has-photo { border-color: var(--good); color: var(--good); }
.photo-preview {
  width: 44px; height: 44px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--line);
  cursor: pointer;
}

/* ============== AUDIT BOTTOM BAR ============== */
.audit-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--paper);
  color: var(--ink);
  z-index: 50;
  border-top: 1px solid var(--hairline);
  box-shadow: 0 -4px 20px rgba(15,17,22,.06);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.audit-footer .footer-score { flex: 1 1 auto; min-width: 0; }
.audit-footer .footer-score .total {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1;
}
.audit-footer .footer-score .total .small { color: var(--mute); font-weight: 500; }
.audit-footer .footer-score .cat-pct {
  font-size: 11px;
  color: var(--mute);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
  margin-top: 4px;
}
.audit-footer .stars-mini {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--gold);
  letter-spacing: 2px;
}

/* Observation button in audit footer */
.foot-obs-btn {
  position: relative;
  background: var(--pink-soft);
  border: 1px solid var(--pink-2);
  color: var(--pink-ink);
  padding: 8px 14px;
  border-radius: 999px;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, transform .08s ease;
  min-height: 38px;
  letter-spacing: 0.01em;
}
.foot-obs-btn:hover { background: var(--pink); color: #5a2038; border-color: var(--pink); }
.foot-obs-btn:active { transform: translateY(1px); }
.foot-obs-btn .foot-obs-count {
  background: var(--ink);
  color: var(--paper);
  font-size: 11px;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 10px;
  margin-left: 4px;
  min-width: 18px;
  text-align: center;
}
.foot-obs-btn .foot-obs-count.hidden { display: none; }
@media (max-width: 420px) {
  .foot-obs-btn .foot-obs-label { display: none; }
  .foot-obs-btn { padding: 8px 11px; }
}

/* ============== CATEGORY PROGRESS BAR ============== */
.catbar {
  height: 5px;
  background: var(--fill);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 20px;
  display: flex;
}
.catbar > div {
  background: var(--pink);
  transition: width .3s ease;
}

/* ============== REPORT VIEW (also used by PDF) ============== */
.report {
  max-width: 860px;
  margin: 0 auto;
  background: var(--paper);
  padding: 48px 56px;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  border: 1px solid var(--hairline);
}
@media (max-width: 640px) { .report { padding: 28px 22px; } }

.report .rep-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 22px;
  margin-bottom: 26px;
}
.report .rep-head .rep-logo {
  height: 56px;
  width: auto;
  display: block;
  margin-bottom: 12px;
}
.report h1.report-title {
  font-size: 38px;
  letter-spacing: -0.04em;
  font-weight: 800;
}
.report .rep-sub {
  color: var(--mute);
  font-size: 14px;
  margin-top: 6px;
  letter-spacing: 0.02em;
}
.report .rep-meta-badge {
  background: var(--ink);
  color: var(--paper);
  padding: 12px 16px;
  border-radius: 10px;
  text-align: right;
  min-width: 160px;
}
.report .rep-meta-badge .val { font-family: var(--serif); font-size: 22px; font-weight: 700; color: var(--paper); }
.report .rep-meta-badge .lbl { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255,255,255,.55); margin-top: 4px; }

.rep-score-banner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  background: linear-gradient(135deg, var(--pink-soft) 0%, #FFFFFF 100%);
  border: 1px solid var(--pink-2);
  border-radius: 16px;
  padding: 24px 28px;
  margin-bottom: 28px;
}
.rep-score-banner .big-num {
  font-family: var(--display);
  font-size: 68px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.055em;
  color: var(--ink);
}
.rep-score-banner .big-num .small { font-size: 22px; color: var(--mute); font-weight: 600; letter-spacing: -0.03em; }
.rep-score-banner .rep-stars {
  font-family: var(--serif);
  font-size: 36px;
  color: var(--gold);
  letter-spacing: 4px;
  line-height: 1;
}
.rep-score-banner .rep-label {
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--mute);
  margin-top: 6px;
}

.rep-category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 28px;
}
.rep-cat {
  padding: 14px 16px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--paper);
}
.rep-cat .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--mute); font-weight: 600; }
.rep-cat .val { font-family: var(--serif); font-size: 22px; font-weight: 600; margin-top: 4px; letter-spacing: -0.025em; }
.rep-cat .val .small { font-size: 13px; color: var(--mute); }
.rep-cat .bar { margin-top: 8px; height: 4px; background: var(--fill); border-radius: 4px; overflow: hidden; }
.rep-cat .bar > div { height: 100%; background: var(--good); }
.rep-cat.low .bar > div { background: var(--bad); }
.rep-cat.mid .bar > div { background: var(--warn); }

.rep-section { margin-top: 32px; }
.rep-section h2 {
  font-size: 22px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  margin-bottom: 14px;
  letter-spacing: -0.015em;
}
.rep-items table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.rep-items td {
  padding: 7px 10px;
  vertical-align: top;
  border-bottom: 1px solid var(--line-soft);
}
.rep-items td.pts { width: 36px; text-align: center; font-family: var(--serif); font-weight: 600; }
.rep-items td.st {
  width: 42px;
  text-align: center;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.06em;
}
.rep-items td.st.y { color: var(--good); }
.rep-items td.st.n { color: var(--bad); }
.rep-items tr.failed td { background: var(--bad-soft); }

.rep-issues { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.rep-issue {
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 14px;
  background: var(--paper);
}
.rep-issue img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  margin-bottom: 10px;
  border: 1px solid var(--line-soft);
}
.rep-issue .ii-cat {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pink-dk);
  font-weight: 700;
}
.rep-issue .ii-text {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 600;
  margin-top: 2px;
  line-height: 1.3;
}
.rep-issue .ii-note { font-size: 12px; color: var(--mute); margin-top: 6px; line-height: 1.4; }

/* ============== MODAL ============== */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(11,12,14,0.5);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}
.modal-bg.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--paper);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 26px 22px 30px;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform .22s cubic-bezier(.2,.8,.2,1);
  box-shadow: var(--shadow-2);
}
.modal-bg.open .modal { transform: translateY(0); }
@media (min-width: 640px) {
  .modal-bg { align-items: center; padding: 20px; }
  .modal { border-radius: var(--r-xl); max-height: 88vh; }
  .modal-bg:not(.open) .modal { transform: translateY(8px); }
}
.modal h2 { margin-bottom: 6px; }
.modal .modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* ============== MISC ============== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--mute);
}
.empty-state .big-mark {
  font-family: var(--serif);
  font-size: 52px;
  line-height: 1;
  color: var(--line);
  margin-bottom: 8px;
}
.empty-state h3 { margin-bottom: 4px; color: var(--ink); }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.badge-good { background: var(--good); color: #fff; }
.badge-bad  { background: var(--bad);  color: #fff; }
.badge-mute { background: var(--fill); color: var(--mute); }
.badge-warn { background: var(--warn); color: #fff; }
.badge-pink { background: var(--pink-soft); color: var(--pink-ink); }

.toast {
  position: fixed;
  bottom: 110px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  z-index: 200;
  box-shadow: var(--shadow-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

.divider { height: 1px; background: var(--hairline); margin: 20px 0; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Pinch-to-zoom image viewer */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(11,12,14,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}
.lightbox.open { opacity: 1; pointer-events: auto; }
.lightbox img { max-width: 100%; max-height: 88vh; border-radius: 10px; }
.lightbox .lb-close {
  position: absolute;
  top: 18px; right: 22px;
  color: #fff;
  background: rgba(255,255,255,0.12);
  border: none;
  font-size: 24px;
  width: 44px; height: 44px;
  border-radius: 22px;
  cursor: pointer;
}

/* Print */
@media print {
  body { background: #fff; padding: 0; }
  .topbar, .nav-tabs, .audit-footer, .actions, .no-print { display: none !important; }
  .report { box-shadow: none; border: none; max-width: 100%; padding: 0; }
  .rep-issue { break-inside: avoid; }
  .rep-items tr { break-inside: avoid; }
}

/* =====================================================
   MOBILE + iPad FINE-TUNING
   ===================================================== */

/* Report: reduce padding on mobile, stack head block vertically, wrap activity log */
@media (max-width: 640px) {
  .report .rep-head {
    flex-direction: column;
    gap: 14px;
  }
  .report .rep-meta-badge {
    width: 100%;
    min-width: 0;
  }
  .rep-score-banner {
    grid-template-columns: 1fr;
    text-align: left;
    padding: 20px 22px;
  }
  .rep-score-banner .big-num { font-size: 52px; }
  .rep-score-banner .rep-stars { font-size: 28px; letter-spacing: 3px; }
}

/* Activity log rows reflow on mobile */
@media (max-width: 600px) {
  .rep-section [style*="grid-template-columns:170px"] {
    grid-template-columns: 1fr !important;
    gap: 2px !important;
    padding: 8px 0 !important;
  }
  .rep-section [style*="grid-template-columns:170px"] > span:nth-child(2) {
    font-size: 11px !important;
  }
}

/* Audit footer — stack label sections on tight screens */
@media (max-width: 420px) {
  .audit-footer { padding: 10px 14px; gap: 10px; }
  .audit-footer .footer-score .total { font-size: 18px; }
  .audit-footer .stars-mini { font-size: 15px; letter-spacing: 1px; }
}

/* FAB — move up on tablet to avoid footer overlap with phones' safe area */
@media (min-width: 768px) {
  .fab { right: 24px; bottom: 102px; }
}

/* Dashboard trend chart stays readable on iPad */
@media (min-width: 820px) and (max-width: 1024px) {
  .trend-wrap { height: 220px; }
}

/* Leaderboard grid reflow on phones */
@media (max-width: 520px) {
  .lb-row {
    grid-template-columns: 30px 1fr auto;
    gap: 10px;
    padding: 10px 4px;
  }
  .lb-spark { display: none; }
  .lb-score { font-size: 16px; min-width: 44px; }
  .lb-rank { font-size: 16px; }
}

/* Recent audits reflow */
@media (max-width: 480px) {
  .recent-row {
    grid-template-columns: 1fr auto;
    gap: 10px;
  }
  .recent-row .r-stars { display: none; }
}

/* Critical fail hotspots reflow */
@media (max-width: 480px) {
  .crit-item {
    grid-template-columns: auto 1fr;
  }
  .crit-item .ci-count {
    grid-column: 2;
    justify-self: start;
    font-size: 16px;
  }
}

/* Item rows reflow — on tiny screens, put Y/N below the text not beside it */
@media (max-width: 380px) {
  .item {
    grid-template-columns: 36px 1fr;
    gap: 10px;
  }
  .points-badge { width: 36px; height: 36px; font-size: 16px; border-radius: 10px; }
  .item-actions {
    grid-column: 2;
    flex-direction: row;
    align-items: center;
    margin-top: -4px;
  }
}

/* Stores page: form row collapses sooner */
@media (max-width: 720px) {
  .card > div[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
}

/* iPad-specific landscape spacing tweaks */
@media (min-width: 1024px) and (max-width: 1200px) {
  .container { max-width: 980px; padding: 28px 24px 24px; }
}

/* Dashboard range toggle wraps gracefully */
@media (max-width: 520px) {
  .range-toggle { width: 100%; justify-content: space-between; }
  .range-toggle button { flex: 1; padding: 7px 6px; font-size: 11px; }
  .dash-header { gap: 10px; }
}

/* Report items table: tighten cells on small screens */
@media (max-width: 480px) {
  .rep-items td { padding: 6px 6px; font-size: 12px; }
  .rep-items td.pts { width: 28px; }
}

/* =====================================================
   ELITE DASHBOARD
   ===================================================== */

.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.dash-header .eyebrow {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--pink-ink, #8B3F5F);
  background: rgba(238, 163, 193, 0.15);
  padding: 5px 12px;
  border-radius: 100px;
  margin-bottom: 12px;
}
.dash-header h1 {
  font-family: var(--display);
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1;
  color: var(--ink);
  margin: 0;
}
.dash-header .sub {
  color: var(--mute);
  font-size: 15px;
  margin-top: 10px;
  font-weight: 400;
  max-width: 560px;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .dash-header h1 { font-size: 34px; }
  .dash-header .sub { font-size: 14px; }
  .dash-header { margin-bottom: 22px; }
}

.range-toggle {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(238, 163, 193, 0.3);
  border-radius: 12px;
  padding: 4px;
  box-shadow: 0 2px 10px rgba(199, 110, 146, 0.06),
              inset 0 1px 0 rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.range-toggle button {
  border: none;
  background: transparent;
  padding: 8px 14px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  color: var(--mute);
  border-radius: 8px;
  cursor: pointer;
  letter-spacing: 0.02em;
  min-height: 32px;
  transition: all .15s ease;
}
.range-toggle button.active {
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 2px 8px rgba(11, 12, 14, 0.15);
}
.range-toggle button:hover:not(.active) { color: var(--ink); }

/* KPI strip — 5 equal cards on desktop, 2-wide on small */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
@media (max-width: 1100px) {
  .kpi-strip { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .kpi-strip { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}
@media (max-width: 380px) {
  .kpi-strip { grid-template-columns: 1fr; }
}
.kpi {
  background: linear-gradient(135deg, rgba(255,255,255,0.9) 0%, rgba(253,236,244,0.55) 100%);
  border: 1px solid rgba(238, 163, 193, 0.28);
  border-radius: 18px;
  padding: 20px 22px;
  box-shadow: 0 2px 10px rgba(199, 110, 146, 0.06),
              inset 0 1px 0 rgba(255, 255, 255, 0.9);
  position: relative;
  overflow: hidden;
  transition: transform .22s cubic-bezier(.2,.8,.2,1),
              box-shadow .22s cubic-bezier(.2,.8,.2,1);
}
.kpi::before {
  content: "";
  position: absolute;
  top: -40px; right: -40px;
  width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(238,163,193,0.35) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.kpi:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(199, 110, 146, 0.15),
              inset 0 1px 0 rgba(255, 255, 255, 1);
}
.kpi .kpi-label {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--pink-ink, #8B3F5F);
  position: relative;
}
.kpi .kpi-val {
  font-family: var(--display);
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-top: 12px;
  color: var(--ink);
  position: relative;
}
.kpi .kpi-val .small { font-size: 16px; color: var(--mute); font-weight: 600; letter-spacing: -0.02em; margin-left: 3px; }
.kpi .kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 4px 10px;
  border-radius: 100px;
  background: var(--fill);
  color: var(--mute);
  position: relative;
}
.kpi .kpi-delta.up   { background: var(--good-soft); color: var(--good); }
.kpi .kpi-delta.down { background: var(--bad-soft);  color: var(--bad); }
.kpi .kpi-hint {
  font-size: 11px;
  color: var(--mute);
  margin-top: 10px;
  letter-spacing: 0.01em;
  position: relative;
  font-weight: 500;
}

/* Highlight accent for the first KPI — dark drama */
.kpi.accent {
  background: linear-gradient(135deg, #0F0A0D 0%, #2A1D24 100%);
  color: var(--paper);
  border-color: transparent;
  box-shadow: 0 4px 24px rgba(11, 12, 14, 0.2),
              inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.kpi.accent::before {
  background: radial-gradient(circle, rgba(238,163,193,0.3) 0%, transparent 70%);
}
.kpi.accent:hover {
  box-shadow: 0 14px 40px rgba(11, 12, 14, 0.3),
              inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.kpi.accent .kpi-label { color: #EEA3C1; }
.kpi.accent .kpi-val { color: var(--paper); }
.kpi.accent .kpi-val .small { color: rgba(255,255,255,0.55); }
.kpi.accent .kpi-hint { color: rgba(255,255,255,0.55); }

/* Panel grid — two columns for chart + side panel */
.panel-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
@media (max-width: 820px) { .panel-grid { grid-template-columns: 1fr; } }

.panel {
  background: linear-gradient(135deg, rgba(255,255,255,0.92) 0%, rgba(253,240,246,0.5) 100%);
  border: 1px solid rgba(238, 163, 193, 0.24);
  border-radius: 18px;
  padding: 22px 24px;
  box-shadow: 0 2px 12px rgba(199, 110, 146, 0.06),
              inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.panel .panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.panel .panel-head h3 {
  font-family: var(--display, 'Playfair Display'), serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.panel .panel-head .panel-sub { font-size: 12px; color: var(--mute); margin-top: 4px; font-weight: 500; }

/* Score trend chart container */
.trend-wrap {
  position: relative;
  height: 240px;
  width: 100%;
}
@media (max-width: 520px) { .trend-wrap { height: 200px; } }

/* Category breakdown mini bars */
.cat-bars { display: flex; flex-direction: column; gap: 10px; }
.cat-bar-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.cat-bar-row .cb-name { font-weight: 600; color: var(--ink); }
.cat-bar-row .cb-val {
  font-family: var(--display);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.cat-bar-row .cb-track {
  grid-column: 1 / -1;
  height: 6px;
  background: var(--fill);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
}
.cat-bar-row .cb-fill {
  height: 100%;
  background: var(--good);
  border-radius: 999px;
  transition: width .4s cubic-bezier(.2,.8,.2,1);
}
.cat-bar-row.low  .cb-fill { background: var(--bad); }
.cat-bar-row.mid  .cb-fill { background: var(--warn); }
.cat-bar-row.high .cb-fill { background: var(--good); }

/* Leaderboard */
.leaderboard { display: flex; flex-direction: column; gap: 0; }
.lb-row {
  display: grid;
  grid-template-columns: 36px 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 12px 6px;
  border-bottom: 1px solid var(--hairline);
  text-decoration: none;
  color: inherit;
  transition: background .12s ease;
}
.lb-row:last-child { border-bottom: 0; }
.lb-row:hover { background: var(--fill); }
.lb-rank {
  font-family: var(--display);
  font-weight: 800;
  font-size: 18px;
  color: var(--mute-2);
  letter-spacing: -0.03em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.lb-row.top-1 .lb-rank { color: var(--gold); }
.lb-info .lb-name {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.01em;
}
.lb-info .lb-meta {
  font-size: 11px;
  color: var(--mute);
  margin-top: 2px;
  font-weight: 500;
}
.lb-spark {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 24px;
  width: 60px;
}
.lb-spark span {
  flex: 1;
  background: var(--pink);
  border-radius: 2px;
  min-height: 2px;
  opacity: 0.9;
}
.lb-score {
  font-family: var(--display);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  min-width: 48px;
  text-align: right;
}
.lb-score .small { font-size: 12px; color: var(--mute); font-weight: 600; }
.lb-score.tone-good { color: var(--good); }
.lb-score.tone-warn { color: var(--warn); }
.lb-score.tone-bad  { color: var(--bad); }

/* Critical fail panel */
.crit-list { display: flex; flex-direction: column; gap: 10px; }
.crit-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: var(--pink-soft);
  border: 1px solid var(--pink-2);
  border-radius: 10px;
}
.crit-item .ci-pts {
  background: var(--pink);
  color: #5a2038;
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 800;
  font-size: 13px;
  font-family: var(--display);
  letter-spacing: -0.01em;
}
.crit-item .ci-text {
  font-size: 13px;
  line-height: 1.35;
  color: var(--ink);
  font-weight: 500;
}
.crit-item .ci-count {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--pink-ink);
  font-variant-numeric: tabular-nums;
}
.crit-item .ci-count .small { font-size: 11px; color: var(--mute); font-weight: 600; margin-left: 2px; }

/* Recent audits table on dashboard */
.recent-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--hairline);
  text-decoration: none;
  color: inherit;
}
.recent-row:last-child { border-bottom: 0; }
.recent-row:hover .r-name { color: var(--pink-dk); }
.r-name { font-weight: 700; font-size: 14px; letter-spacing: -0.01em; transition: color .12s ease; }
.r-meta { font-size: 12px; color: var(--mute); margin-top: 2px; font-weight: 500; }
.r-stars { font-family: var(--display); color: var(--gold); letter-spacing: 2px; font-size: 14px; }

/* =====================================================
   FLOATING ACTION BUTTON (add observation during audit)
   ===================================================== */
.fab {
  position: fixed;
  right: 18px;
  bottom: 94px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--pink);
  color: #5a2038;
  border: none;
  font-size: 28px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(238,163,193,0.45), 0 2px 6px rgba(15,17,22,0.12);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.fab:hover { background: var(--pink-dk); color: #fff; transform: translateY(-2px); box-shadow: 0 10px 24px rgba(238,163,193,0.5); }
.fab:active { transform: translateY(1px); }
.fab .fab-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--ink);
  color: var(--paper);
  font-size: 11px;
  font-weight: 800;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sans);
  box-shadow: 0 0 0 2px var(--paper);
}
.fab .fab-badge.hidden { display: none; }

/* =====================================================
   OBSERVATIONS (ad-hoc audit findings)
   ===================================================== */
.obs-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.obs-card {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: var(--shadow-1);
}
.obs-card .obs-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}
.obs-card .obs-cat {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--pink-dk);
  background: var(--pink-soft);
  padding: 3px 8px;
  border-radius: 4px;
}
.obs-card .obs-time {
  font-size: 11px;
  color: var(--mute);
  font-weight: 600;
}
.obs-card .obs-text {
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.obs-card .obs-photos {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.obs-card .obs-photos img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--hairline);
  cursor: pointer;
}
.obs-card .obs-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.obs-card .obs-actions button {
  border: none;
  background: transparent;
  font-size: 12px;
  color: var(--mute);
  cursor: pointer;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  font-family: var(--sans);
}
.obs-card .obs-actions button:hover { background: var(--fill); color: var(--ink); }
.obs-card .obs-actions button.danger:hover { background: var(--bad-soft); color: var(--bad); }

/* Observation modal photo thumbs */
.obs-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.obs-photo-grid .thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--hairline);
}
.obs-photo-grid .thumb img {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
}
.obs-photo-grid .thumb .rm {
  position: absolute;
  top: 4px; right: 4px;
  background: rgba(11,12,14,0.7);
  color: #fff;
  border: none;
  width: 22px; height: 22px;
  border-radius: 11px;
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.obs-photo-grid .thumb.add {
  background: var(--fill);
  border: 1.5px dashed var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--mute);
  font-size: 24px;
  font-weight: 400;
  transition: border-color .15s ease, color .15s ease;
}
.obs-photo-grid .thumb.add:hover {
  border-color: var(--pink);
  color: var(--pink-dk);
}
.obs-photo-grid .thumb.add.disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* Observations section in report */
.rep-obs { display: grid; grid-template-columns: 1fr; gap: 14px; }.rep-obs-item {
  background: var(--paper);
  border: 1px solid var(--pink-2);
  border-radius: 12px;
  padding: 16px 18px;
}
.rep-obs-item .ro-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}
.rep-obs-item .ro-cat {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--pink-dk);
}
.rep-obs-item .ro-time { font-size: 11px; color: var(--mute); font-weight: 600; }
.rep-obs-item .ro-text {
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.rep-obs-item .ro-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.rep-obs-item .ro-photos img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--hairline);
}

/* =====================================================
   CATEGORY DEDUCTIONS (audit form)
   ===================================================== */
.deductions-section {
  margin-top: 18px;
  padding: 18px;
  background: var(--fill);
  border: 1px dashed var(--line);
  border-radius: 12px;
}
.deductions-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.deductions-head h3 { margin: 0; }
.deductions-empty {
  font-size: 13px;
  color: var(--mute);
  font-style: italic;
  padding: 8px 4px;
}
.deductions-list { display: flex; flex-direction: column; gap: 10px; }
.deduction-card {
  background: var(--paper);
  border: 1px solid var(--warn);
  border-left: 4px solid var(--warn);
  border-radius: 10px;
  padding: 14px 16px;
}
.deduction-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: flex-start;
}
.deduction-pts {
  background: var(--warn-soft);
  color: var(--warn);
  padding: 8px 12px;
  border-radius: 8px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.03em;
  text-align: center;
  line-height: 1;
  min-width: 60px;
}
.deduction-pts span {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 2px;
  opacity: 0.7;
}
.deduction-body { min-width: 0; }
.deduction-text {
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink);
  font-weight: 500;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.deduction-meta {
  font-size: 11px;
  color: var(--mute);
  margin-top: 4px;
  letter-spacing: 0.01em;
  text-transform: capitalize;
  font-weight: 600;
}
.deduction-photos {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.deduction-photos img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--hairline);
  cursor: pointer;
}
.deduction-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.deduction-actions button {
  border: none;
  background: transparent;
  font-size: 12px;
  color: var(--mute);
  cursor: pointer;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  font-family: var(--sans);
}
.deduction-actions button:hover { background: var(--fill); color: var(--ink); }
.deduction-actions button.danger:hover { background: var(--bad-soft); color: var(--bad); }

/* =====================================================
   REPORT — scoring breakdown + penalty display
   ===================================================== */
.rep-breakdown {
  background: var(--fill);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 14px;
  font-size: 13px;
  line-height: 1.7;
}
.rep-breakdown .row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 4px 0;
}
.rep-breakdown .row.total {
  border-top: 1px solid var(--line);
  margin-top: 6px;
  padding-top: 10px;
  font-weight: 700;
}
.rep-breakdown .tone-bad { color: var(--bad); }
.rep-breakdown .tone-warn { color: var(--warn); }

.rep-cat-badge {
  display: inline-block;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  background: var(--bad-soft);
  color: var(--bad);
  margin-left: 8px;
}

/* Report: category deductions section */
.rep-cat-deductions {
  margin: 12px 0;
  padding: 12px 14px;
  background: var(--warn-soft);
  border-left: 3px solid var(--warn);
  border-radius: 6px;
}
.rep-cat-deductions-head {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--warn);
  margin-bottom: 6px;
}
.rep-cat-deductions-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  font-size: 12px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(185,122,20,0.15);
  align-items: flex-start;
}
.rep-cat-deductions-item:last-child { border-bottom: 0; }
.rep-cat-deductions-item .pts {
  font-family: var(--display);
  font-weight: 800;
  color: var(--warn);
  font-size: 14px;
  letter-spacing: -0.02em;
}
.rep-cat-deductions-item .photos {
  display: flex;
  gap: 4px;
}
.rep-cat-deductions-item .photos img {
  width: 40px; height: 40px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--hairline);
}

/* =====================================================
   v1.5 — additional widget polish
   ===================================================== */

/* Editable points badge (audit form) */
.edit-points-btn {
  cursor: pointer;
  border: 1px solid var(--hairline);
  transition: transform .08s ease, border-color .15s ease, background .15s ease;
  padding: 0;
}
.edit-points-btn:hover {
  border-color: var(--pink);
  background: var(--pink-soft);
}
.edit-points-btn:active { transform: scale(0.96); }
.item.critical .edit-points-btn:hover {
  background: var(--pink-dk);
  color: #fff;
}

/* Multi-photo strip under each item */
.item-photos-wrap {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.item-photo-thumb {
  position: relative;
  width: 44px;
  height: 44px;
}
.item-photo-img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  cursor: pointer;
  display: block;
}
.item-photo-thumb .rm {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border: none;
  background: var(--ink);
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  box-shadow: 0 0 0 2px var(--paper);
}

/* AI draft box (audit summary tab) */
.ai-draft {
  background: linear-gradient(135deg, #fafaff 0%, var(--pink-soft) 100%);
  border: 1px solid var(--pink-2);
  border-radius: 12px;
  padding: 20px 24px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink);
}
.ai-draft h3 {
  font-size: 14px;
  letter-spacing: -0.01em;
  font-weight: 800;
  margin: 14px 0 6px;
  color: var(--pink-ink);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ai-draft h3:first-child { margin-top: 0; }
.ai-draft p { margin: 0 0 12px; }
.ai-draft ol, .ai-draft ul { padding-left: 22px; margin: 6px 0 14px; }
.ai-draft ol li, .ai-draft ul li { margin-bottom: 8px; line-height: 1.55; }
.ai-draft strong { color: var(--pink-dk); font-weight: 700; }

/* Auditor's summary on report */
.rep-auditor-summary {
  background: linear-gradient(135deg, rgba(253, 236, 244, 0.6) 0%, rgba(255, 255, 255, 0.4) 100%);
  border: 1px solid rgba(238, 163, 193, 0.35);
  border-left: 4px solid var(--pink-dk);
  border-radius: 12px;
  padding: 22px 26px;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--ink);
  word-wrap: break-word;
  box-shadow: 0 2px 10px rgba(199, 110, 146, 0.06);
}
.rep-auditor-summary p {
  margin: 0 0 12px;
}
.rep-auditor-summary p:last-child {
  margin-bottom: 0;
}
.rep-auditor-summary strong {
  color: var(--pink-dk);
  font-weight: 800;
  letter-spacing: -0.005em;
}
.rep-auditor-summary em { font-style: italic; }
.rep-auditor-summary h3,
.rep-auditor-summary h4,
.rep-auditor-summary h5,
.rep-auditor-summary h6 {
  font-family: var(--display);
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--pink-dk);
  margin: 16px 0 8px;
  text-transform: none;
  border: 0;
  padding: 0;
}
.rep-auditor-summary h3:first-child,
.rep-auditor-summary h4:first-child,
.rep-auditor-summary h5:first-child,
.rep-auditor-summary h6:first-child { margin-top: 0; }
.rep-auditor-summary h3 { font-size: 16px; }
.rep-auditor-summary ul,
.rep-auditor-summary ol {
  margin: 8px 0 12px;
  padding-left: 22px;
}
.rep-auditor-summary ul:last-child,
.rep-auditor-summary ol:last-child { margin-bottom: 0; }
.rep-auditor-summary li {
  margin: 4px 0;
  line-height: 1.6;
}
.rep-auditor-summary li::marker { color: var(--pink-dk); }
.rep-auditor-summary br + br { display: block; content: ""; margin-top: 6px; }

/* Tighten item row on phones when photos are present (avoid cramped layout) */
@media (max-width: 520px) {
  .item-meta-row {
    flex-wrap: wrap;
    gap: 6px;
  }
  .item-meta-row .photo-btn {
    order: 1;
  }
  .item-photos-wrap {
    order: 2;
    width: 100%;
  }
  .item-meta-row .note-input {
    order: 3;
    width: 100%;
  }
}

/* Summary textarea focus ring on its wrapper card */
#summary-text:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--pink);
  border-radius: 14px;
}

/* =====================================================
   v1.6 — AI WELCOME BRIEFING + CHAT
   ===================================================== */

/* ---------- AI BRIEFING (dashboard top) — elite ---------- */
.ai-briefing {
  background: linear-gradient(135deg, #0F0A0D 0%, #2A1D24 60%, #3A2830 100%);
  border: 1px solid rgba(238, 163, 193, 0.3);
  border-radius: 22px;
  padding: 28px 32px;
  margin-bottom: 24px;
  box-shadow: 0 10px 40px rgba(11, 12, 14, 0.22),
              inset 0 1px 0 rgba(255, 255, 255, 0.08);
  position: relative;
  overflow: hidden;
  color: #fff;
}
.ai-briefing::before {
  content: "";
  position: absolute;
  top: -80px; right: -80px;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(238,163,193,0.35) 0%, transparent 60%);
  pointer-events: none;
}
.ai-briefing::after {
  content: "";
  position: absolute;
  bottom: -60px; left: -60px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(199,110,146,0.2) 0%, transparent 70%);
  pointer-events: none;
}
.ai-briefing-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  position: relative;
  z-index: 1;
}
.ai-briefing-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #EEA3C1 0%, #C76E92 100%);
  color: #fff;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(199, 110, 146, 0.4);
}
.ai-briefing-sparkle {
  font-size: 14px;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.6));
}
.ai-briefing-refresh {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.75);
  padding: 7px 14px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--sans);
  transition: all .15s ease;
  backdrop-filter: blur(6px);
}
.ai-briefing-refresh:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(238, 163, 193, 0.5);
  color: #fff;
}
.ai-briefing-refresh:disabled { opacity: 0.5; cursor: not-allowed; }

.ai-briefing-body {
  font-size: 15px;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.88);
  position: relative;
  z-index: 1;
}
.ai-briefing-body .briefing-lead {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin: 0 0 20px;
  color: #fff;
}
.ai-briefing-body .briefing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
@media (max-width: 720px) {
  .ai-briefing-body .briefing-grid { grid-template-columns: 1fr; }
  .ai-briefing { padding: 22px 22px; }
  .ai-briefing-body .briefing-lead { font-size: 18px; }
}
.ai-briefing-body .briefing-card {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 16px 18px;
}
.ai-briefing-body .briefing-card h4 {
  font-family: var(--display);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0 0 8px;
  color: #EEA3C1;
}
.ai-briefing-body .briefing-card p {
  font-size: 13px;
  line-height: 1.55;
  margin: 0;
  color: rgba(255, 255, 255, 0.92);
}
.ai-briefing-body .briefing-nudge {
  background: var(--ink);
  color: var(--paper);
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  margin: 0;
  line-height: 1.5;
}

.ai-briefing-loading {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--mute);
  font-size: 14px;
  padding: 6px 0;
}
.ai-briefing-empty {
  padding: 10px 4px;
  font-size: 14px;
  color: var(--mute);
  line-height: 1.5;
}
.ai-briefing-empty p { margin: 0; }
.ai-briefing-error {
  padding: 12px 16px;
  background: var(--bad-soft);
  border: 1px solid var(--bad);
  border-radius: 10px;
  color: var(--bad);
  font-size: 14px;
}
.ai-briefing-error code {
  background: rgba(0,0,0,0.06);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: ui-monospace, monospace;
}

/* Thinking dots */
.ai-thinking-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.ai-thinking-dots span {
  width: 7px;
  height: 7px;
  background: var(--pink-dk);
  border-radius: 50%;
  animation: ai-dot 1.2s ease-in-out infinite;
}
.ai-thinking-dots span:nth-child(2) { animation-delay: 0.15s; }
.ai-thinking-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes ai-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ---------- GLOBAL CHAT BUBBLE (floating) ---------- */
#ai-chat-fab {
  position: fixed;
  right: 22px;
  bottom: 26px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--ink) 0%, var(--ink-2) 100%);
  color: var(--paper);
  border: none;
  padding: 12px 20px;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 14px;
  z-index: 90;
  box-shadow: 0 6px 18px rgba(11,12,14,0.24), 0 0 0 3px rgba(238,163,193,0.18);
  transition: transform .15s ease, box-shadow .15s ease;
  letter-spacing: 0.01em;
}
#ai-chat-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(11,12,14,0.3), 0 0 0 4px rgba(238,163,193,0.28);
}
#ai-chat-fab:active { transform: translateY(1px); }
.ai-chat-fab-icon {
  font-size: 16px;
  filter: drop-shadow(0 0 4px rgba(238,163,193,0.6));
}
@media (max-width: 480px) {
  #ai-chat-fab { right: 14px; bottom: 18px; padding: 11px 14px; }
  .ai-chat-fab-label { display: none; }
}

.ai-chat-scrim {
  position: fixed;
  inset: 0;
  background: rgba(11,12,14,0.3);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.ai-chat-scrim.open {
  opacity: 1;
  pointer-events: auto;
}

.ai-chat-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(440px, 100vw);
  background: var(--paper);
  z-index: 101;
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 30px rgba(11,12,14,0.15);
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.2,.8,.2,1);
}
.ai-chat-drawer.open { transform: translateX(0); }
@media (max-width: 480px) {
  .ai-chat-drawer { width: 100vw; }
}

.ai-chat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--hairline);
  gap: 10px;
  background: linear-gradient(135deg, #FDFAFF 0%, var(--pink-soft) 100%);
}
.ai-chat-title {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.ai-chat-sub {
  font-size: 11px;
  color: var(--mute);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  margin-top: 2px;
}
#ai-chat-close {
  background: rgba(0,0,0,0.05);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 16px;
  cursor: pointer;
  font-size: 14px;
  color: var(--mute);
  transition: background .15s ease;
}
#ai-chat-close:hover { background: rgba(0,0,0,0.1); color: var(--ink); }

.ai-chat-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--canvas);
}

.ai-chat-welcome {
  text-align: center;
  padding: 30px 20px;
  color: var(--mute);
}
.ai-chat-welcome-icon {
  font-size: 42px;
  margin-bottom: 10px;
  filter: drop-shadow(0 2px 8px rgba(238,163,193,0.5));
}
.ai-chat-welcome h3 {
  font-family: var(--display);
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 17px;
}
.ai-chat-welcome p {
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
  max-width: 320px;
  margin: 0 auto;
}

.ai-msg {
  display: flex;
  max-width: 92%;
}
.ai-msg.is-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.ai-msg.is-ai { align-self: flex-start; }
.ai-msg-body {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.ai-msg.is-user .ai-msg-body {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
  border-bottom-right-radius: 4px;
}
.ai-msg.is-ai .ai-msg-body {
  background: var(--paper);
  border-bottom-left-radius: 4px;
}
.ai-msg.is-thinking .ai-msg-body { padding: 14px 18px; }

.ai-msg-body h3, .ai-msg-body h4 {
  font-size: 13px;
  font-weight: 800;
  margin: 12px 0 4px;
  color: var(--pink-ink);
  letter-spacing: 0.02em;
}
.ai-msg-body h3:first-child, .ai-msg-body h4:first-child { margin-top: 0; }
.ai-msg-body p { margin: 0 0 10px; }
.ai-msg-body p:last-child { margin-bottom: 0; }
.ai-msg-body ul, .ai-msg-body ol { padding-left: 20px; margin: 6px 0 10px; }
.ai-msg-body li { margin-bottom: 6px; }
.ai-msg-body strong { color: var(--ink); }
.ai-msg.is-user .ai-msg-body strong { color: var(--paper); }
.ai-msg-body code {
  background: rgba(0,0,0,0.06);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: ui-monospace, "SF Mono", monospace;
}
.ai-msg-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 6px 0;
}
.ai-msg-body th, .ai-msg-body td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--hairline);
}
.ai-msg-body th {
  font-weight: 700;
  color: var(--mute);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ai-chat-suggestions {
  padding: 10px 16px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--canvas);
}
.ai-chat-sugg-btn {
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--sans);
  transition: all .15s ease;
}
.ai-chat-sugg-btn:hover {
  border-color: var(--pink);
  background: var(--pink-soft);
  color: var(--pink-ink);
}
.ai-chat-sugg-btn.ai-clear {
  margin-left: auto;
  color: var(--mute);
}

.ai-chat-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 14px 16px;
  border-top: 1px solid var(--hairline);
  background: var(--paper);
}
.ai-chat-input-row textarea {
  flex: 1 1 auto;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 10px 16px;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.4;
  resize: none;
  min-height: 40px;
  max-height: 160px;
  background: var(--canvas);
}
.ai-chat-input-row textarea:focus {
  outline: none;
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(238,163,193,0.2);
}
#ai-chat-send {
  background: var(--ink);
  color: var(--paper);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
  transition: background .15s ease;
}
#ai-chat-send:hover { background: var(--ink-2); }

/* ---------- ASK AI dedicated page ---------- */
.suggestion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
}
.suggestion-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--paper);
  border: 1px solid var(--hairline);
  padding: 12px 14px;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink);
  transition: all .15s ease;
}
.suggestion-btn:hover {
  border-color: var(--pink);
  background: var(--pink-soft);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(238,163,193,0.15);
}
.suggestion-icon {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}
.suggestion-text {
  flex: 1 1 auto;
  font-weight: 500;
}

.ask-thread {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 20px 0;
}
.ask-msg {
  display: flex;
  gap: 12px;
  max-width: 100%;
}
.ask-msg.is-user { flex-direction: row-reverse; }
.ask-msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--fill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  border: 1px solid var(--hairline);
}
.ask-msg.is-user .ask-msg-avatar {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.ask-msg.is-ai .ask-msg-avatar {
  background: linear-gradient(135deg, var(--pink-soft), var(--pink-2));
  border-color: var(--pink-2);
}
.ask-msg-bubble {
  flex: 1 1 auto;
  min-width: 0;
  max-width: calc(100% - 48px);
}
.ask-msg-body {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
  word-wrap: break-word;
}
.ask-msg.is-user .ask-msg-body {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.ask-msg.is-user .ask-msg-body strong { color: var(--paper); }
.ask-msg-body h3, .ask-msg-body h4 {
  font-size: 14px;
  font-weight: 800;
  margin: 14px 0 6px;
  color: var(--pink-ink);
  letter-spacing: 0.01em;
}
.ask-msg-body h3:first-child, .ask-msg-body h4:first-child { margin-top: 0; }
.ask-msg-body p { margin: 0 0 10px; }
.ask-msg-body p:last-child { margin-bottom: 0; }
.ask-msg-body ul, .ask-msg-body ol { padding-left: 22px; margin: 6px 0 12px; }
.ask-msg-body li { margin-bottom: 6px; }
.ask-msg-body strong { color: var(--pink-dk); }
.ask-msg-body code {
  background: rgba(0,0,0,0.05);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: ui-monospace, monospace;
  font-size: 13px;
}

/* =====================================================
   ASK AI PAGE — tight centred chat layout
   ===================================================== */
.ask-container {
  max-width: 860px;
  margin: 0 auto;
  padding-bottom: 40px;
}
.ask-header {
  text-align: center;
  padding: 28px 8px 12px;
}
.ask-header .eyebrow {
  justify-content: center;
  display: inline-block;
}
.ask-header h1 {
  margin: 8px 0 6px;
  font-family: var(--display);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
}
.ask-lede {
  color: var(--mute);
  font-size: 14px;
  line-height: 1.55;
  margin: 0 auto;
  max-width: 580px;
}

.ask-suggestions-card {
  margin-top: 24px;
  padding: 20px 22px;
  background: linear-gradient(135deg, #fafaff 0%, var(--pink-soft) 100%);
  border: 1px solid rgba(238, 163, 193, 0.35);
  border-radius: 18px;
  box-shadow: 0 2px 12px rgba(199, 110, 146, 0.06);
}
.ask-suggestions-head {
  font-size: 10px;
  letter-spacing: 0.18em;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--pink-ink);
  margin-bottom: 14px;
}

.ask-thread:empty { display: none; }

.ask-input-card {
  position: relative;
  margin-top: 24px;
  background: #fff;
  border: 1px solid rgba(238, 163, 193, 0.35);
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: 0 10px 28px rgba(199, 110, 146, 0.1),
              0 2px 6px rgba(11, 12, 14, 0.04),
              inset 0 1px 0 rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color .15s, box-shadow .15s;
}
.ask-input-card:focus-within {
  border-color: var(--pink);
  box-shadow: 0 14px 34px rgba(199, 110, 146, 0.15),
              0 0 0 4px rgba(238, 163, 193, 0.18),
              inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.ask-input-card textarea {
  width: 100%;
  border: none;
  padding: 6px 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  resize: none;
  min-height: 40px;
  max-height: 200px;
  background: transparent;
  color: var(--ink);
}
.ask-input-card textarea:focus { outline: none; }
.ask-input-card textarea::placeholder {
  color: rgba(11, 12, 14, 0.4);
  letter-spacing: 0.005em;
}
.ask-input-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.ask-input-hint {
  font-size: 11px;
  color: var(--mute);
  letter-spacing: 0.01em;
}

@media (max-width: 640px) {
  .ask-container { padding-left: 16px; padding-right: 16px; }
  .ask-header { padding: 20px 4px 8px; }
  .ask-header h1 { font-size: 28px; }
  .ask-lede { font-size: 13px; }
  .ask-suggestions-card { padding: 16px 14px; border-radius: 14px; }
  .ask-input-card { padding: 12px 14px; border-radius: 14px; }
  .ask-input-hint { display: none; }
}

/* =====================================================
   FAIL BADGE — used in report item rows & training
   Replaces the Y/N single-letter cells for cleaner output.
   ===================================================== */
.fail-badge {
  display: inline-block;
  background: var(--bad);
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.3;
}
.rep-items td.st {
  text-align: right;
  white-space: nowrap;
  width: 60px;
}

/* Safety net — hide any legacy "Y" status cell content on reports.
   Our current code outputs an empty cell for passed items, but this
   guarantees older cached HTML/audits won't show a stray Y either. */
.rep-items .st.y,
.rep-items td.st.y {
  color: transparent !important;
  font-size: 0 !important;
}
.rep-items .st.y::before,
.rep-items td.st.y::before { content: ""; }

/* =====================================================
   REPORT KPI STRIP — elite stats at top of every audit
   ===================================================== */
.rep-kpi-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin: 20px 0 16px;
}
.rep-kpi {
  background: linear-gradient(135deg, #FFFFFF 0%, var(--pink-soft) 100%);
  border: 1px solid var(--pink-2);
  border-radius: 12px;
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
  transition: transform .15s ease;
}
.rep-kpi::before {
  content: "";
  position: absolute;
  top: -20px; right: -20px;
  width: 60px; height: 60px;
  background: radial-gradient(circle, rgba(238,163,193,0.3), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.rep-kpi.dark {
  background: linear-gradient(135deg, #1A1216 0%, #3A2830 100%);
  color: #fff;
  border: none;
}
.rep-kpi.dark::before {
  background: radial-gradient(circle, rgba(238,163,193,0.25), transparent 70%);
}
.rep-kpi.good {
  background: linear-gradient(135deg, #F4F9F5 0%, #E6F2EA 100%);
  border: 1px solid #B8D9C2;
}
.rep-kpi.warn {
  background: linear-gradient(135deg, #FFF8EB 0%, #FFEBCC 100%);
  border: 1px solid #E5B877;
}
.rep-kpi.bad {
  background: linear-gradient(135deg, #FDEEEF 0%, #F9D4D8 100%);
  border: 1px solid #E9A0A7;
}
.rep-kpi-val {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--ink);
}
.rep-kpi.dark .rep-kpi-val { color: #fff; }
.rep-kpi.good .rep-kpi-val { color: var(--good); }
.rep-kpi.warn .rep-kpi-val { color: var(--warn); }
.rep-kpi.bad .rep-kpi-val { color: var(--bad); }
.rep-kpi-sub {
  font-size: 14px;
  color: var(--mute);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.rep-kpi.dark .rep-kpi-sub { color: rgba(255,255,255,0.55); }
.rep-kpi.good .rep-kpi-sub { color: rgba(47,125,79,0.55); }
.rep-kpi.warn .rep-kpi-sub { color: rgba(185,122,20,0.55); }
.rep-kpi.bad .rep-kpi-sub { color: rgba(183,45,59,0.55); }
.rep-kpi-lbl {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--mute);
  margin-top: 6px;
  line-height: 1.2;
}
.rep-kpi.dark .rep-kpi-lbl { color: rgba(255,255,255,0.65); }
.rep-kpi.good .rep-kpi-lbl { color: rgba(47,125,79,0.75); }
.rep-kpi.warn .rep-kpi-lbl { color: rgba(185,122,20,0.75); }
.rep-kpi.bad .rep-kpi-lbl { color: rgba(183,45,59,0.75); }
.rep-kpi-hint {
  font-size: 11px;
  color: var(--mute);
  margin-top: 4px;
  line-height: 1.3;
  font-weight: 500;
}
.rep-kpi.dark .rep-kpi-hint { color: rgba(255,255,255,0.55); }
.rep-kpi.good .rep-kpi-hint { color: rgba(47,125,79,0.7); }
.rep-kpi.warn .rep-kpi-hint { color: rgba(185,122,20,0.7); }
.rep-kpi.bad .rep-kpi-hint { color: rgba(183,45,59,0.7); }

/* Mobile reflow */
@media (max-width: 900px) {
  .rep-kpi-strip { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .rep-kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .rep-kpi-val { font-size: 24px; }
}
@media (max-width: 380px) {
  .rep-kpi-strip { grid-template-columns: 1fr; }
}

/* Print: keep the KPIs looking sharp on PDF export */
@media print {
  .rep-kpi-strip {
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 8px !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .rep-kpi {
    padding: 10px 12px;
    break-inside: avoid;
  }
}

/* =====================================================
   REPORT — TOP ACTION STRIP
   ===================================================== */
#report-actions-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.rat-left { display: flex; gap: 8px; flex-wrap: wrap; }
.rat-right { display: flex; gap: 8px; align-items: center; }
.btn.btn-md {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

/* =====================================================
   REPORT MODE SWITCHER — card pill selector
   ===================================================== */
#report-mode-switcher {
  margin-bottom: 22px;
  padding: 18px;
  background: linear-gradient(135deg, rgba(255,255,255,0.9) 0%, rgba(253,240,245,0.55) 100%);
  border: 1px solid rgba(238, 163, 193, 0.32);
  border-radius: 20px;
  box-shadow: 0 2px 12px rgba(199, 110, 146, 0.06),
              inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.rms-eyebrow {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--pink-ink);
  margin-bottom: 12px;
}
.rms-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.rms-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  text-align: left;
  font-family: var(--sans);
  transition: all .18s cubic-bezier(.2,.8,.2,1);
  min-width: 0;
  position: relative;
}
.rms-card:hover {
  border-color: rgba(238, 163, 193, 0.6);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(199, 110, 146, 0.08);
}
.rms-card.active {
  border-color: var(--pink);
  background: linear-gradient(135deg, #fff 0%, rgba(253, 236, 244, 0.4) 100%);
  box-shadow: 0 4px 18px rgba(199, 110, 146, 0.18),
              inset 0 0 0 1.5px var(--pink);
}
.rms-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  background: rgba(238, 163, 193, 0.12);
  color: var(--pink-ink);
  transition: all .18s;
}
.rms-card.active .rms-icon {
  background: linear-gradient(135deg, #EEA3C1 0%, #C76E92 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(199, 110, 146, 0.25);
}
.rms-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.rms-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.rms-sub {
  font-size: 12px;
  color: var(--mute);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.005em;
}
.rms-card.active .rms-sub { color: var(--pink-ink); }
.rms-check {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: transparent;
  color: transparent;
  transition: all .18s;
}
.rms-card.active .rms-check {
  background: var(--pink-dk);
  color: #fff;
  box-shadow: 0 2px 6px rgba(139, 63, 95, 0.25);
}

@media (max-width: 720px) {
  .rms-grid { grid-template-columns: 1fr; }
  .rms-sub { display: block; }
}
@media (max-width: 520px) {
  #report-mode-switcher { padding: 14px; border-radius: 16px; }
  .rms-card { padding: 12px 14px; gap: 12px; }
  .rms-icon { width: 38px; height: 38px; }
  .rms-title { font-size: 14px; }
  .rms-sub { font-size: 11px; }
  #report-actions-top { gap: 10px; }
  .rat-left, .rat-right { width: 100%; }
  .rat-right .btn { flex: 1; justify-content: center; }
}

/* =====================================================
   AI REFINE CHAT MODAL
   ===================================================== */
.rsc-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 12, 14, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: rsc-overlay-in .18s ease;
}
@keyframes rsc-overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.rsc-modal {
  background: linear-gradient(180deg, #fff 0%, #FFFBFD 100%);
  border-radius: 22px;
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.35),
              0 0 0 1px rgba(238, 163, 193, 0.3);
  animation: rsc-modal-in .25s cubic-bezier(.2,.8,.2,1);
  overflow: hidden;
}
@keyframes rsc-modal-in {
  from { transform: translateY(14px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.rsc-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 22px 24px 14px;
  border-bottom: 1px solid rgba(238, 163, 193, 0.25);
  background: linear-gradient(180deg, rgba(253, 240, 245, 0.5) 0%, transparent 100%);
}
.rsc-modal-title {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
}
.rsc-modal-sub {
  font-size: 12px;
  color: var(--mute);
  margin-top: 6px;
  line-height: 1.5;
}
.rsc-modal-close {
  background: rgba(238, 163, 193, 0.12);
  border: none;
  width: 36px; height: 36px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--ink);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  flex-shrink: 0;
}
.rsc-modal-close:hover {
  background: rgba(238, 163, 193, 0.25);
}
.rsc-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.rsc-chat-draft {
  background: var(--fill);
  border: 1px dashed rgba(238, 163, 193, 0.35);
  border-radius: 12px;
  padding: 14px 16px;
}
.rsc-chat-label {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--pink-ink);
  margin-bottom: 8px;
}
.rsc-chat-drafttext {
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
  white-space: pre-wrap;
}
.rsc-chat-msg {
  display: flex;
}
.rsc-chat-msg.user { justify-content: flex-end; }
.rsc-chat-msg.ai { justify-content: flex-start; }
.rsc-chat-bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
}
.rsc-chat-msg.user .rsc-chat-bubble {
  background: var(--ink);
  color: var(--paper);
  border-bottom-right-radius: 6px;
}
.rsc-chat-msg.ai .rsc-chat-bubble {
  background: var(--pink-soft);
  color: var(--ink);
  border-bottom-left-radius: 6px;
  border: 1px solid rgba(238, 163, 193, 0.3);
}
.rsc-chat-ai-draft {
  white-space: pre-wrap;
}
.rsc-chat-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(199, 110, 146, 0.2);
}
.rsc-chat-loader { color: var(--mute); font-style: italic; }
.rsc-chat-loader .dots {
  display: inline-block;
  animation: rsc-dots 1.4s infinite;
}
@keyframes rsc-dots {
  0%, 20% { opacity: 0.2; }
  50% { opacity: 1; }
  100% { opacity: 0.2; }
}
.rsc-modal-foot {
  padding: 14px 20px;
  border-top: 1px solid rgba(238, 163, 193, 0.25);
  display: flex;
  gap: 8px;
  background: rgba(253, 240, 245, 0.3);
}
#rsc-chat-input {
  flex: 1;
  border: 1px solid rgba(238, 163, 193, 0.35);
  border-radius: 100px;
  padding: 10px 16px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  background: #fff;
  min-width: 0;
  transition: border-color .15s;
}
#rsc-chat-input:focus {
  outline: none;
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(238, 163, 193, 0.18);
}
#rsc-chat-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
#rsc-chat-send {
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .rsc-modal-overlay { padding: 10px; }
  .rsc-modal { max-height: calc(100vh - 20px); }
  .rsc-modal-head { padding: 16px 18px 12px; }
  .rsc-modal-title { font-size: 17px; }
  .rsc-modal-body { padding: 16px 18px; }
  .rsc-modal-foot { padding: 12px 14px; }
  .rsc-chat-bubble { max-width: 92%; }
}

/* ------ Mode visibility ------ */
/* .full-only sections only render in Full mode */
.report.mode-customer .full-only { display: none !important; }
/* When NOT in customer mode (i.e. full mode), full-only shows normally */

/* Customer mode badge — clear visual sign the user is looking at the store-facing version */
.report.mode-customer::before {
  content: "CUSTOMER COPY — FOR STORE MANAGER";
  display: block;
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.24em;
  font-weight: 800;
  color: var(--pink-ink);
  background: linear-gradient(135deg, rgba(238, 163, 193, 0.18) 0%, rgba(253, 236, 244, 0.3) 100%);
  border: 1px dashed rgba(238, 163, 193, 0.5);
  padding: 8px 14px;
  border-radius: 100px;
  margin: 0 auto 20px;
  max-width: max-content;
}

/* Cat block in Full scorecard — visual sub-hierarchy (not a top-level section) */
.rep-cat-block {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed rgba(238, 163, 193, 0.3);
}
.rep-cat-block:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.rep-cat-block-head {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0 0 12px;
  color: var(--ink);
}
.pass-tick {
  color: var(--good);
  font-weight: 800;
  font-size: 14px;
  opacity: 0.5;
}
.rep-clean-pass {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(185, 225, 198, 0.25) 0%, rgba(253, 236, 244, 0.4) 100%);
  border: 1px solid rgba(52, 168, 83, 0.15);
  border-radius: 14px;
  margin: 8px 0 4px;
}
.rcp-icon {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #52B96A 0%, #34A853 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(52, 168, 83, 0.3);
}
.rcp-text { flex: 1; min-width: 0; }
.rcp-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.rcp-sub {
  font-size: 12px;
  color: var(--mute);
  margin-top: 2px;
}
.rcp-score {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 800;
  color: var(--good);
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.note-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  background: rgba(238, 163, 193, 0.18);
  color: var(--pink-dk);
  border-radius: 100px;
}
.photo-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 13px;
  background: rgba(238, 163, 193, 0.15);
  border-radius: 100px;
}
.rep-items tr.has-note td.st { text-align: right; }

/* =====================================================
   AUDIT HISTORY — SINGLE CLICKABLE ROWS
   ===================================================== */
.hist-card {
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0;
  margin-top: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(11, 12, 14, 0.03);
  transition: all .18s cubic-bezier(.2,.8,.2,1);
  text-decoration: none;
  color: inherit;
  position: relative;
}
.hist-card:hover {
  box-shadow: 0 8px 24px rgba(199, 110, 146, 0.12);
  border-color: rgba(238, 163, 193, 0.5);
  transform: translateY(-1px);
}
.hist-card:active { transform: translateY(0); }
.hist-main {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 18px 22px;
}
.hist-info { min-width: 0; }
.hist-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.25;
}
.hist-meta {
  font-size: 12px;
  color: var(--mute);
  margin-top: 4px;
  letter-spacing: 0.01em;
}
.hist-hint {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pink-dk);
  margin-top: 8px;
  opacity: 0;
  transform: translateX(-4px);
  transition: all .2s;
}
.hist-card:hover .hist-hint {
  opacity: 1;
  transform: translateX(0);
}
.hist-hint-draft {
  color: #9a7a0d;
  opacity: 1;  /* always visible on drafts to make the action obvious */
  transform: none;
}
.hist-score {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}
.hist-stars {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--pink);
  letter-spacing: 2px;
  line-height: 1;
}
.hist-pct {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  min-width: 58px;
  text-align: right;
  color: var(--ink);
}
.hist-pct-mute {
  color: var(--mute);
  font-size: 14px;
  font-weight: 500;
}

@media (max-width: 560px) {
  .hist-main {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 16px 18px;
  }
  .hist-score {
    justify-content: space-between;
  }
  .hist-pct { min-width: 0; }
  .hist-hint { opacity: 1; transform: none; }
}

/* =====================================================
   REPORT — READ-ONLY SUMMARY HINT + EMPTY STATE
   ===================================================== */
.rep-summary-hint {
  margin-top: 12px;
  font-size: 12px;
  color: var(--mute);
  display: flex;
  align-items: center;
  gap: 4px;
  letter-spacing: 0.005em;
}
.rep-summary-hint-link {
  color: var(--pink-dk);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid rgba(199, 110, 146, 0.3);
  transition: border-color .15s, color .15s;
}
.rep-summary-hint-link:hover {
  color: var(--pink-dk);
  border-bottom-color: var(--pink-dk);
}

.rep-summary-empty {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  background: linear-gradient(135deg, rgba(253, 246, 250, 0.7) 0%, rgba(255,255,255,0.5) 100%);
  border: 1px dashed rgba(238, 163, 193, 0.45);
  border-radius: 14px;
}
.rse-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #EEA3C1 0%, #C76E92 100%);
  color: #fff;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(199, 110, 146, 0.25);
}
.rse-title {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--ink);
}
.rse-sub {
  font-size: 12px;
  color: var(--mute);
  margin-top: 2px;
  line-height: 1.5;
}

/* =====================================================
   ✦ AI COMMAND CENTRE
   ===================================================== */
.page-aicmd { background: linear-gradient(180deg, #FAF8F9 0%, #F7F3F5 100%); min-height: 100vh; }
.ai-cmd-wrap { padding-bottom: 80px; max-width: 1340px; }

/* Hero */
.ai-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 28px;
  align-items: center;
  margin: 24px 0 28px;
  padding: 28px 32px;
  background: linear-gradient(135deg, #8C3E5E 0%, #B85F8A 40%, #D67FA4 100%);
  border-radius: 22px;
  color: #fff;
  box-shadow: 0 20px 50px rgba(199, 110, 146, 0.25),
              inset 0 1px 0 rgba(255, 255, 255, 0.08);
  position: relative;
  overflow: hidden;
}
.ai-hero::before {
  content: "";
  position: absolute;
  top: -50%; right: -10%;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(238, 163, 193, 0.18) 0%, transparent 65%);
  pointer-events: none;
}
.ai-hero::after {
  content: "";
  position: absolute;
  bottom: -40%; left: -10%;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(199, 110, 146, 0.14) 0%, transparent 65%);
  pointer-events: none;
}
.ai-hero-left { position: relative; z-index: 1; min-width: 0; }
.ai-hero-eyebrow {
  font-size: 10px;
  letter-spacing: 0.22em;
  font-weight: 800;
  color: rgba(238, 163, 193, 0.9);
  margin-bottom: 12px;
  text-transform: uppercase;
}
.ai-hero-title {
  font-family: var(--display);
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin: 0 0 10px;
  color: #fff;
  text-shadow: 0 2px 20px rgba(199, 110, 146, 0.2);
}
.ai-hero-sub {
  font-size: 16px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.86);
  margin: 0;
  max-width: 760px;
  letter-spacing: -0.005em;
}
.ai-hero-right {
  display: flex;
  gap: 14px;
  align-items: center;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}
.ai-hero-kpi {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  padding: 14px 20px;
  min-width: 108px;
  backdrop-filter: blur(10px);
}
.ai-hero-kpi-label {
  font-size: 9px;
  letter-spacing: 0.18em;
  font-weight: 800;
  color: rgba(238, 163, 193, 0.85);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.ai-hero-kpi-value {
  font-family: var(--display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  line-height: 1;
}

@media (max-width: 880px) {
  .ai-hero { grid-template-columns: 1fr; padding: 22px 20px; }
  .ai-hero-right { order: -1; flex-wrap: wrap; }
  .ai-hero-kpi { flex: 1; min-width: 90px; padding: 10px 14px; }
  .ai-hero-title { font-size: 28px; }
  .ai-hero-sub { font-size: 14px; }
}

/* Grid layouts */
.ai-grid { display: grid; gap: 20px; margin-bottom: 20px; }
.ai-grid-2-1 { grid-template-columns: 2fr 1fr; }
.ai-grid-1-1 { grid-template-columns: 1fr 1fr; }
.ai-grid-full { grid-template-columns: 1fr; }

@media (max-width: 980px) {
  .ai-grid-2-1, .ai-grid-1-1 { grid-template-columns: 1fr; }
}

/* Base card */
.ai-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(11, 12, 14, 0.04);
  position: relative;
  transition: box-shadow .18s, border-color .18s;
}
.ai-card:hover {
  box-shadow: 0 8px 24px rgba(11, 12, 14, 0.06);
}
.ai-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding: 20px 24px 14px;
  border-bottom: 1px solid rgba(238, 163, 193, 0.18);
  flex-wrap: wrap;
}
.ai-card-head-left { flex: 1; min-width: 0; }
.ai-card-eyebrow {
  font-size: 9px;
  letter-spacing: 0.22em;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.ai-eyebrow-urgent { color: #c42a2a; }
.ai-eyebrow-hq { color: #8C3E5E; }
.ai-eyebrow-predict { color: #b45a00; }
.ai-eyebrow-root { color: #1e4d6b; }
.ai-eyebrow-lb { color: #a37b00; }
.ai-eyebrow-coach { color: var(--pink-dk); }

.ai-card-title {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.018em;
  color: var(--ink);
  margin: 0 0 6px;
  line-height: 1.2;
}
.ai-card-sub {
  font-size: 13px;
  color: var(--mute);
  line-height: 1.5;
  margin: 0;
  letter-spacing: 0.005em;
  max-width: 680px;
}
.ai-card-refresh {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(238, 163, 193, 0.1);
  border: 1px solid rgba(238, 163, 193, 0.25);
  color: var(--pink-dk);
  cursor: pointer;
  transition: all .15s;
}
.ai-card-refresh:hover {
  background: var(--pink-soft);
  border-color: var(--pink);
  transform: rotate(90deg);
}
.ai-card-body { padding: 18px 24px 20px; min-height: 120px; }
.ai-card-foot {
  padding: 0 24px 14px;
  font-size: 11px;
  color: var(--mute);
  letter-spacing: 0.02em;
}
.ai-foot-fresh::before { content: "✦  "; color: var(--pink-dk); }

/* Loading + error states */
.ai-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 4px;
  color: var(--mute);
  font-size: 13px;
  letter-spacing: 0.01em;
}
.ai-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(238, 163, 193, 0.25);
  border-top-color: var(--pink-dk);
  animation: ai-spin 0.9s linear infinite;
  flex-shrink: 0;
}
@keyframes ai-spin { to { transform: rotate(360deg); } }
.ai-error {
  padding: 16px;
  background: rgba(196, 42, 42, 0.05);
  border: 1px solid rgba(196, 42, 42, 0.2);
  border-radius: 10px;
  color: #b02828;
  font-size: 13px;
}

/* ====== Priority Engine ====== */
.pe-bucket { margin-bottom: 20px; }
.pe-bucket:last-child { margin-bottom: 0; }
.pe-bucket-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed rgba(238, 163, 193, 0.25);
}
.pe-bucket-icon { font-size: 13px; }
.pe-bucket-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--ink);
}
.pe-bucket-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  color: var(--mute);
  background: rgba(11, 12, 14, 0.05);
  padding: 2px 8px;
  border-radius: 100px;
}
.pe-item {
  display: flex;
  gap: 14px;
  padding: 12px 14px;
  margin-bottom: 8px;
  background: linear-gradient(135deg, rgba(255,255,255,1) 0%, rgba(253, 246, 250, 0.4) 100%);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: border-color .15s, transform .15s;
}
.pe-item:hover { border-color: rgba(238, 163, 193, 0.4); transform: translateX(2px); }
.pe-bucket-urgent .pe-item { border-left: 3px solid #c42a2a; }
.pe-bucket-drops .pe-item { border-left: 3px solid #b45a00; }
.pe-bucket-wins .pe-item { border-left: 3px solid #1e6b34; }
.pe-item-rank {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(11, 12, 14, 0.06);
  font-size: 11px;
  font-weight: 800;
  color: var(--ink);
}
.pe-item-body { flex: 1; min-width: 0; }
.pe-item-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.005em;
  margin-bottom: 4px;
}
.pe-item-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
  font-size: 11px;
}
.pe-store {
  color: var(--pink-dk);
  font-weight: 700;
  letter-spacing: 0.01em;
}
.pe-lift {
  font-weight: 700;
  color: var(--ink);
  padding: 2px 8px;
  background: rgba(238, 163, 193, 0.15);
  border-radius: 100px;
}
.pe-item-why {
  font-size: 12.5px;
  color: var(--mute);
  line-height: 1.5;
}

/* ====== Head Office ====== */
.hq-headline {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
  margin-bottom: 18px;
  background: linear-gradient(135deg, #8C3E5E 0%, #D67FA4 100%);
  border-radius: 14px;
  color: #fff;
}
.hq-headline-big {
  font-family: var(--display);
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  color: #fff;
  text-shadow: 0 2px 14px rgba(238, 163, 193, 0.3);
}
.hq-headline-text {
  font-size: 14px;
  line-height: 1.5;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: -0.005em;
}
.hq-opp {
  display: flex;
  gap: 12px;
  padding: 12px;
  margin-bottom: 8px;
  background: rgba(214, 127, 164, 0.05);
  border: 1px solid rgba(214, 127, 164, 0.18);
  border-radius: 10px;
}
.hq-opp-rank {
  flex-shrink: 0;
  width: 22px; height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #D67FA4;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}
.hq-opp-body { flex: 1; min-width: 0; }
.hq-opp-issue { font-size: 13.5px; font-weight: 700; color: var(--ink); margin-bottom: 3px; }
.hq-opp-meta { display: flex; gap: 10px; font-size: 11px; color: var(--mute); margin-bottom: 4px; }
.hq-opp-lift {
  color: #8C3E5E;
  font-weight: 800;
  padding: 1px 7px;
  background: rgba(214, 127, 164, 0.14);
  border-radius: 100px;
}
.hq-opp-action { font-size: 12px; color: var(--mute); line-height: 1.45; }
.hq-risk {
  margin-top: 14px;
  padding: 12px 14px;
  background: rgba(180, 90, 0, 0.06);
  border: 1px solid rgba(180, 90, 0, 0.2);
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink);
}
.hq-risk-label {
  display: block;
  font-size: 9px;
  letter-spacing: 0.18em;
  font-weight: 800;
  text-transform: uppercase;
  color: #b45a00;
  margin-bottom: 4px;
}

/* ====== Predictions ====== */
.pr-summary {
  padding: 10px 14px;
  margin-bottom: 12px;
  background: rgba(180, 90, 0, 0.06);
  border: 1px solid rgba(180, 90, 0, 0.2);
  border-radius: 10px;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.5;
}
.pr-empty {
  padding: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--good);
  background: rgba(30, 107, 52, 0.05);
  border: 1px solid rgba(30, 107, 52, 0.2);
  border-radius: 10px;
}
.pr-row {
  display: flex;
  gap: 14px;
  padding: 12px;
  margin-bottom: 8px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}
.pr-row-high { border-left: 4px solid #c42a2a; background: linear-gradient(135deg, rgba(196, 42, 42, 0.04) 0%, rgba(255,255,255,1) 100%); }
.pr-row-med { border-left: 4px solid #b45a00; background: linear-gradient(135deg, rgba(180, 90, 0, 0.04) 0%, rgba(255,255,255,1) 100%); }
.pr-row-low { border-left: 4px solid #888; }
.pr-prob {
  flex-shrink: 0;
  width: 64px;
  text-align: center;
  padding-right: 12px;
  border-right: 1px dashed rgba(238, 163, 193, 0.25);
}
.pr-prob-num {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink);
}
.pr-prob-num span { font-size: 11px; color: var(--mute); font-weight: 500; }
.pr-row-high .pr-prob-num { color: #c42a2a; }
.pr-row-med .pr-prob-num { color: #b45a00; }
.pr-prob-label {
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--mute);
  margin-top: 2px;
}
.pr-body { flex: 1; min-width: 0; }
.pr-store {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.005em;
  margin-bottom: 6px;
}
.pr-code {
  font-size: 10px;
  font-weight: 600;
  color: var(--mute);
  background: rgba(11, 12, 14, 0.05);
  padding: 2px 7px;
  border-radius: 4px;
  margin-left: 4px;
  letter-spacing: 0.02em;
}
.pr-reasons {
  margin: 0;
  padding: 0 0 0 18px;
  font-size: 12px;
  color: var(--mute);
  line-height: 1.55;
}
.pr-reasons li { margin: 2px 0; }
.pr-reasons li::marker { color: var(--pink-dk); }

/* ====== Root Cause ====== */
.rc-theme {
  display: flex;
  gap: 14px;
  padding: 14px;
  margin-bottom: 10px;
  background: linear-gradient(135deg, rgba(30, 77, 107, 0.03) 0%, rgba(255,255,255,1) 100%);
  border: 1px solid rgba(30, 77, 107, 0.18);
  border-radius: 12px;
}
.rc-theme-num {
  flex-shrink: 0;
  width: 26px; height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #1e4d6b;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}
.rc-theme-body { flex: 1; min-width: 0; }
.rc-theme-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
  letter-spacing: -0.005em;
}
.rc-theme-insight {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.55;
  margin-bottom: 8px;
}
.rc-theme-stores {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}
.rc-chip {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: #1e4d6b;
  background: rgba(30, 77, 107, 0.08);
  padding: 3px 8px;
  border-radius: 100px;
  letter-spacing: 0.01em;
}
.rc-theme-action {
  font-size: 12px;
  color: var(--mute);
  line-height: 1.5;
  padding-top: 8px;
  border-top: 1px dashed rgba(30, 77, 107, 0.2);
}
.rc-action-label {
  font-weight: 800;
  color: #1e4d6b;
  letter-spacing: 0.02em;
}

/* ====== Leaderboard ====== */
.lb-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 780px) { .lb-grid { grid-template-columns: 1fr; } }
.lb-col {
  background: linear-gradient(180deg, rgba(253, 246, 250, 0.5) 0%, rgba(255,255,255,1) 30%);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
.lb-col-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed rgba(238, 163, 193, 0.3);
}
.lb-col-icon { font-size: 14px; }
.lb-col-top .lb-col-icon { color: #a37b00; }
.lb-col-imp .lb-col-icon { color: #1e6b34; }
.lb-col-risk .lb-col-icon { color: #c42a2a; }
.lb-row {
  display: flex;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid rgba(238, 163, 193, 0.12);
}
.lb-row:last-child { border-bottom: none; }
.lb-rank {
  flex-shrink: 0;
  width: 22px; height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(11, 12, 14, 0.05);
  font-size: 10px;
  font-weight: 800;
  color: var(--ink);
}
.lb-col-top .lb-row:nth-child(2) .lb-rank { background: linear-gradient(135deg, #f4c97a 0%, #a37b00 100%); color: #fff; }
.lb-body { flex: 1; min-width: 0; }
.lb-store {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.005em;
  margin-bottom: 3px;
}
.lb-meta { display: flex; gap: 8px; align-items: center; font-size: 11px; margin-bottom: 4px; }
.lb-score {
  font-family: var(--display);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.lb-trend {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 100px;
  letter-spacing: 0.02em;
}
.lb-trend-up { background: rgba(30, 107, 52, 0.1); color: #1e6b34; }
.lb-trend-dn { background: rgba(196, 42, 42, 0.1); color: #c42a2a; }
.lb-trend-flat { background: rgba(11, 12, 14, 0.06); color: var(--mute); }
.lb-comment {
  font-size: 11.5px;
  color: var(--mute);
  line-height: 1.45;
  font-style: italic;
}
.lb-empty {
  padding: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--mute);
}

/* ====== Manager Coach ====== */
.ai-coach-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.ai-store-select {
  min-width: 260px;
  padding: 8px 14px;
  border: 1px solid rgba(238, 163, 193, 0.35);
  border-radius: 10px;
  font-family: var(--sans);
  font-size: 13px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: border-color .15s;
}
.ai-store-select:hover, .ai-store-select:focus {
  border-color: var(--pink);
  outline: none;
}
.ai-coach-empty {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 28px 20px;
  background: linear-gradient(135deg, rgba(253, 246, 250, 0.6) 0%, rgba(255,255,255,0.8) 100%);
  border: 1px dashed rgba(238, 163, 193, 0.4);
  border-radius: 14px;
}
.ai-coach-empty-icon {
  width: 48px; height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: linear-gradient(135deg, #EEA3C1 0%, #C76E92 100%);
  color: #fff;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(199, 110, 146, 0.3);
}
.ai-coach-empty-title {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.005em;
  margin-bottom: 3px;
}
.ai-coach-empty-sub {
  font-size: 12px;
  color: var(--mute);
  line-height: 1.5;
}
.mc-plan { position: relative; }
.mc-plan-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px dashed rgba(238, 163, 193, 0.3);
}
.mc-plan-store {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.015em;
}
.mc-code {
  font-size: 11px;
  font-weight: 600;
  color: var(--mute);
  background: rgba(11, 12, 14, 0.05);
  padding: 2px 7px;
  border-radius: 4px;
  margin-left: 6px;
  letter-spacing: 0.02em;
}
.mc-plan-stats { display: flex; gap: 12px; font-size: 12px; color: var(--mute); }
.mc-plan-stats strong { color: var(--ink); font-family: var(--display); font-size: 18px; }
.mc-trend {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 100px;
  letter-spacing: 0.02em;
  align-self: center;
}
.mc-trend-up { background: rgba(30, 107, 52, 0.12); color: #1e6b34; }
.mc-trend-dn { background: rgba(196, 42, 42, 0.12); color: #c42a2a; }
.mc-trend-flat { background: rgba(11, 12, 14, 0.06); color: var(--mute); }

.mc-headline {
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  margin-bottom: 18px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(238, 163, 193, 0.1) 0%, rgba(253, 246, 250, 0.4) 100%);
  border-left: 3px solid var(--pink-dk);
  border-radius: 10px;
  font-weight: 500;
}
.mc-tone-strong .mc-headline { border-left-color: #1e6b34; background: linear-gradient(135deg, rgba(30, 107, 52, 0.08) 0%, rgba(255,255,255,0.6) 100%); }
.mc-tone-urgent .mc-headline { border-left-color: #c42a2a; background: linear-gradient(135deg, rgba(196, 42, 42, 0.08) 0%, rgba(255,255,255,0.6) 100%); }
.mc-tone-needs-focus .mc-headline { border-left-color: #b45a00; background: linear-gradient(135deg, rgba(180, 90, 0, 0.08) 0%, rgba(255,255,255,0.6) 100%); }

.mc-section { margin-bottom: 18px; }
.mc-section:last-child { margin-bottom: 0; }
.mc-section-label {
  font-size: 10px;
  letter-spacing: 0.18em;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--pink-dk);
  margin-bottom: 10px;
}
.mc-focus {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.mc-focus-num {
  flex-shrink: 0;
  width: 26px; height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--pink-dk);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}
.mc-focus-body { flex: 1; min-width: 0; }
.mc-focus-head { display: flex; gap: 10px; margin-bottom: 4px; flex-wrap: wrap; }
.mc-focus-area {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pink-dk);
}
.mc-focus-freq {
  font-size: 10px;
  font-weight: 700;
  color: var(--mute);
  background: rgba(11, 12, 14, 0.05);
  padding: 2px 7px;
  border-radius: 100px;
  letter-spacing: 0.04em;
}
.mc-focus-action {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
  letter-spacing: -0.005em;
}
.mc-focus-why {
  font-size: 12px;
  color: var(--mute);
  line-height: 1.5;
  margin-bottom: 4px;
}
.mc-focus-owner {
  font-size: 11px;
  color: var(--mute);
}
.mc-rhythm {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.7;
}
.mc-rhythm li::marker { color: var(--pink-dk); }
.mc-motivation {
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(238, 163, 193, 0.08) 0%, rgba(253, 246, 250, 0.3) 100%);
  border: 1px solid rgba(238, 163, 193, 0.28);
  border-radius: 10px;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.55;
  font-style: italic;
}

/* Footnote + gate */
.ai-footnote {
  margin-top: 22px;
  padding: 14px 18px;
  text-align: center;
  font-size: 11.5px;
  color: var(--mute);
  letter-spacing: 0.01em;
  line-height: 1.55;
}
.ai-gate-block {
  max-width: 480px;
  margin: 60px auto;
  padding: 40px 32px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(11, 12, 14, 0.04);
}
.ai-gate-icon {
  width: 56px; height: 56px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: linear-gradient(135deg, #EEA3C1 0%, #C76E92 100%);
  color: #fff;
  font-size: 22px;
  box-shadow: 0 6px 20px rgba(199, 110, 146, 0.3);
}
.ai-gate-title {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-bottom: 8px;
}
.ai-gate-sub {
  font-size: 13px;
  color: var(--mute);
  line-height: 1.55;
}

/* Mobile adjustments */
@media (max-width: 560px) {
  .ai-card-head { padding: 16px 18px 12px; }
  .ai-card-body { padding: 14px 18px 16px; }
  .ai-card-foot { padding: 0 18px 12px; }
  .ai-card-title { font-size: 19px; }
  .ai-card-sub { font-size: 12px; }
  .hq-headline-big { font-size: 36px; }
  .ai-coach-picker { width: 100%; }
  .ai-store-select { min-width: 0; flex: 1; }
}

/* =====================================================
   ✦ AI PHOTO ANALYSIS — on-demand button on report issues
   ===================================================== */
.rep-issue-photo-wrap { position: relative; }
.rep-issue-ai {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  background: linear-gradient(135deg, #EEA3C1 0%, #C76E92 100%);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 100px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(199, 110, 146, 0.35);
  transition: all .15s;
  backdrop-filter: blur(4px);
}
.rep-issue-ai:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(199, 110, 146, 0.45);
}
.rep-issue-ai:disabled {
  opacity: 0.75;
  cursor: default;
}
.rep-issue-ai.analysed {
  background: linear-gradient(135deg, #4ea06b 0%, #1e6b34 100%);
  box-shadow: 0 3px 10px rgba(30, 107, 52, 0.3);
}
.rep-ai-spinner {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  animation: ai-spin 0.7s linear infinite;
}
.rep-issue-ai-result {
  grid-column: 1 / -1;
  margin-top: 8px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(238, 163, 193, 0.08) 0%, rgba(253, 246, 250, 0.3) 100%);
  border: 1px solid rgba(238, 163, 193, 0.3);
  border-radius: 12px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink);
}
.rep-ai-analysing {
  font-size: 12px;
  color: var(--mute);
  font-style: italic;
}
.rep-ai-heading {
  font-size: 10px;
  letter-spacing: 0.16em;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--pink-dk);
  margin-bottom: 6px;
}
.rep-ai-body {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink);
}
.rep-ai-error {
  font-size: 12px;
  color: #c42a2a;
}

/* =====================================================
   🇬🇧 LIVE UK CLOCK — in the top bar, ticks every second
   ===================================================== */
.uk-clock {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: linear-gradient(135deg, #fff 0%, rgba(253, 246, 250, 0.7) 100%);
  border: 1px solid rgba(238, 163, 193, 0.35);
  border-radius: 100px;
  font-family: var(--mono, 'SF Mono', 'Menlo', 'Consolas', monospace);
  font-size: 12px;
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(199, 110, 146, 0.08);
  user-select: none;
  white-space: nowrap;
}
.uk-clock-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #1e6b34;
  box-shadow: 0 0 0 2px rgba(30, 107, 52, 0.18);
  animation: uk-clock-pulse 2s ease-in-out infinite;
}
@keyframes uk-clock-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 2px rgba(30, 107, 52, 0.18); }
  50% { opacity: 0.65; box-shadow: 0 0 0 4px rgba(30, 107, 52, 0.06); }
}
.uk-clock-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--pink-dk);
  text-transform: uppercase;
}
.uk-clock-time {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--ink);
  min-width: 54px;
  text-align: right;
}

@media (max-width: 720px) {
  .uk-clock-label { display: none; }
  .uk-clock { padding: 6px 10px; gap: 6px; }
}
@media (max-width: 480px) {
  .uk-clock { display: none; }  /* Save space on very narrow phones */
}

/* =====================================================
   USERS PAGE — elite hero + table redesign
   ===================================================== */
.users-wrap { padding-bottom: 60px; max-width: 1280px; }

/* Hero — matches AI Command's visual language */
.users-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: center;
  margin: 24px 0 24px;
  padding: 28px 32px;
  background: linear-gradient(135deg, #8C3E5E 0%, #B85F8A 40%, #D67FA4 100%);
  border-radius: 22px;
  color: #fff;
  box-shadow: 0 20px 50px rgba(199, 110, 146, 0.25),
              inset 0 1px 0 rgba(255, 255, 255, 0.08);
  position: relative;
  overflow: hidden;
}
.users-hero::before {
  content: "";
  position: absolute;
  top: -60%; right: -10%;
  width: 460px; height: 460px;
  background: radial-gradient(circle, rgba(238, 163, 193, 0.2) 0%, transparent 65%);
  pointer-events: none;
}
.users-hero::after {
  content: "";
  position: absolute;
  bottom: -50%; left: -8%;
  width: 380px; height: 380px;
  background: radial-gradient(circle, rgba(199, 110, 146, 0.15) 0%, transparent 65%);
  pointer-events: none;
}
.users-hero-left { position: relative; z-index: 1; min-width: 0; }
.users-hero-eyebrow {
  font-size: 10px;
  letter-spacing: 0.22em;
  font-weight: 800;
  color: rgba(238, 163, 193, 0.9);
  margin-bottom: 12px;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
}
.users-hero-title {
  font-family: var(--display);
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin: 0 0 10px;
  color: #fff;
  text-shadow: 0 2px 20px rgba(199, 110, 146, 0.2);
}
.users-hero-sub {
  font-size: 15px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.86);
  margin: 0 0 18px;
  max-width: 580px;
  letter-spacing: -0.005em;
}
.users-hero-actions .btn {
  background: #fff !important;
  color: var(--pink-dk) !important;
  border: 0 !important;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(199, 110, 146, 0.3);
}
.users-hero-actions .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(199, 110, 146, 0.4);
}
.users-hero-right {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}
.users-hero-kpi {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  padding: 14px 18px;
  min-width: 120px;
  backdrop-filter: blur(10px);
}
.users-hero-kpi-label {
  font-size: 9px;
  letter-spacing: 0.18em;
  font-weight: 800;
  color: rgba(238, 163, 193, 0.85);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.users-hero-kpi-value {
  font-family: var(--display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  line-height: 1;
}

@media (max-width: 880px) {
  .users-hero { grid-template-columns: 1fr; padding: 22px 20px; gap: 22px; }
  .users-hero-title { font-size: 28px; }
  .users-hero-sub { font-size: 13px; }
  .users-hero-right { grid-template-columns: repeat(4, 1fr); }
  .users-hero-kpi { padding: 10px 12px; min-width: 0; }
  .users-hero-kpi-value { font-size: 20px; }
}
@media (max-width: 560px) {
  .users-hero-right { grid-template-columns: repeat(2, 1fr); }
}

/* Toolbar row: search + filter chips */
.users-toolbar {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.users-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 100px;
  min-width: 280px;
  flex: 1;
  max-width: 420px;
  transition: border-color .15s, box-shadow .15s;
}
.users-search svg {
  flex-shrink: 0;
  color: var(--mute);
}
.users-search input {
  flex: 1;
  border: 0;
  outline: 0;
  font-family: var(--sans);
  font-size: 13.5px;
  background: transparent;
  color: var(--ink);
  padding: 2px 0;
}
.users-search input::placeholder { color: var(--mute); }
.users-search:focus-within {
  border-color: var(--pink);
  box-shadow: 0 0 0 4px rgba(238, 163, 193, 0.15);
}
.users-filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.users-chip {
  padding: 7px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 100px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--mute);
  cursor: pointer;
  transition: all .15s;
  letter-spacing: -0.005em;
}
.users-chip:hover {
  border-color: rgba(238, 163, 193, 0.5);
  color: var(--ink);
}
.users-chip.active {
  background: linear-gradient(135deg, #EEA3C1 0%, #C76E92 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 3px 10px rgba(199, 110, 146, 0.3);
}

/* Table wrapper card */
.users-table-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(11, 12, 14, 0.03);
}
.users-loading, .users-error {
  padding: 40px;
  text-align: center;
  color: var(--mute);
  font-size: 13px;
}
.users-error { color: var(--bad); }
.users-empty {
  padding: 48px 24px;
  text-align: center;
}
.users-empty-icon {
  width: 48px; height: 48px;
  margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(238, 163, 193, 0.15) 0%, rgba(199, 110, 146, 0.08) 100%);
  color: var(--pink-dk);
}
.users-empty-title {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-bottom: 4px;
}
.users-empty-sub {
  font-size: 13px;
  color: var(--mute);
}

/* Avatar + name cell */
.users-name-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}
.users-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #EEA3C1 0%, #C76E92 100%);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.01em;
  box-shadow: 0 2px 6px rgba(199, 110, 146, 0.18);
}
.users-avatar[data-role="super_admin"] {
  background: linear-gradient(135deg, #0B0C0E 0%, #8C3E5E 100%);
}
.users-avatar[data-role="area_manager"] {
  background: linear-gradient(135deg, #C76E92 0%, #8B3F5F 100%);
}
.users-avatar[data-role="auditor"] {
  background: linear-gradient(135deg, #D67FA4 0%, #8C3E5E 100%);
}
.users-name {
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.users-you-pill {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--pink-dk);
  background: rgba(238, 163, 193, 0.15);
  padding: 2px 7px;
  border-radius: 100px;
  margin-top: 3px;
}
.users-email {
  font-size: 13px;
  color: var(--mute);
}
.users-all-stores {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pink-dk);
  background: rgba(238, 163, 193, 0.12);
  padding: 4px 10px;
  border-radius: 100px;
}
.users-last-login {
  font-size: 12px;
  color: var(--mute);
  letter-spacing: 0.005em;
}
.users-actions-cell {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* =====================================================
   📱 MOBILE BOTTOM NAVIGATION — phone widths only
   ===================================================== */
@media (max-width: 720px) {
  .nav-tabs { display: none !important; }
  body { padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px)); }
  #ai-chat-fab { display: none !important; }
  /* Compact topbar on phone */
  .topbar .topbar-new-audit { display: none; }
}

.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid rgba(238, 163, 193, 0.22);
  box-shadow: 0 -4px 16px rgba(11, 12, 14, 0.04);
  z-index: 100;
  padding: 6px 8px calc(4px + env(safe-area-inset-bottom, 0px));
  justify-content: space-around;
  align-items: stretch;
}
@media (max-width: 720px) { .mobile-bottom-nav { display: flex; } }

.mbn-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 2px 4px;
  text-decoration: none;
  color: var(--mute);
  background: transparent;
  border: 0;
  font-family: var(--sans);
  cursor: pointer;
  position: relative;
  transition: color .15s;
  min-width: 0;
}
.mbn-item:active { transform: scale(0.94); }
.mbn-item.active { color: var(--pink-dk); }
.mbn-item.active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 26px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: linear-gradient(90deg, #EEA3C1 0%, #C76E92 100%);
}
.mbn-icon { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; }
.mbn-icon svg { width: 22px; height: 22px; stroke-width: 1.8; }
.mbn-item.active .mbn-icon svg { stroke-width: 2.2; }
.mbn-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.mbn-primary .mbn-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, #EEA3C1 0%, #C76E92 100%);
  color: #fff;
  box-shadow: 0 6px 16px rgba(199, 110, 146, 0.4);
  margin-top: -14px;
}
.mbn-primary .mbn-icon svg { stroke-width: 2.4; width: 22px; height: 22px; color: #fff; }
.mbn-primary .mbn-label { color: var(--pink-dk); font-weight: 800; }

.mbn-sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(11, 12, 14, 0.45);
  z-index: 200;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.mbn-sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.mbn-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  border-radius: 22px 22px 0 0;
  padding: 16px 18px calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 201;
  transform: translateY(100%);
  transition: transform .24s cubic-bezier(.2,.8,.2,1);
  box-shadow: 0 -8px 32px rgba(11, 12, 14, 0.18);
  max-height: 70vh;
  overflow-y: auto;
}
.mbn-sheet.open { transform: translateY(0); }
.mbn-sheet-handle {
  width: 40px; height: 4px;
  background: var(--line);
  border-radius: 2px;
  margin: 0 auto 14px;
}
.mbn-sheet-title {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-bottom: 12px;
  padding-left: 4px;
}
.mbn-sheet-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.mbn-sheet-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  text-decoration: none;
  color: var(--ink);
  transition: all .15s;
}
.mbn-sheet-item:active {
  transform: scale(0.96);
  background: var(--pink-soft);
  border-color: var(--pink);
}
.mbn-sheet-icon {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(238,163,193,0.12) 0%, rgba(199,110,146,0.08) 100%);
  color: var(--pink-dk);
}
.mbn-sheet-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-align: center;
}

/* =====================================================
   ⚡ TODAY PANEL — mobile-first action dashboard
   ===================================================== */
.page-today { background: linear-gradient(180deg, #FAF8F9 0%, #F7F3F5 100%); min-height: 100vh; }
.today-wrap { max-width: 760px; padding-bottom: 60px; }

.today-hero {
  padding: 24px 4px 6px;
}
.today-hero-eyebrow {
  font-size: 10px;
  letter-spacing: 0.22em;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--pink-dk);
  margin-bottom: 10px;
}
.today-hero-title {
  font-family: var(--display);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.028em;
  line-height: 1.05;
  color: var(--ink);
  margin: 0 0 8px;
}
.today-hero-sub {
  font-size: 15px;
  line-height: 1.55;
  color: var(--mute);
  margin: 0;
  letter-spacing: -0.005em;
  max-width: 620px;
}

/* Stats row */
.today-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 20px 0 10px;
}
.today-stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 12px;
  text-align: center;
  transition: transform .12s;
}
.today-stat:active { transform: scale(0.97); }
.today-stat-urgent { border-left: 4px solid #c42a2a; }
.today-stat-attn { border-left: 4px solid #b45a00; }
.today-stat-wins { border-left: 4px solid #1e6b34; }
.ts-count {
  font-family: var(--display);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1;
}
.today-stat-urgent .ts-count { color: #c42a2a; }
.today-stat-attn .ts-count { color: #b45a00; }
.today-stat-wins .ts-count { color: #1e6b34; }
.ts-label {
  font-size: 10px;
  letter-spacing: 0.16em;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--mute);
  margin-top: 4px;
}

/* Section */
.today-section { margin: 28px 0 16px; }
.today-sec-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 0 4px;
}
.today-sec-head h2 {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.018em;
  color: var(--ink);
  margin: 0;
  flex: 1;
}
.today-sec-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-urgent { background: #c42a2a; box-shadow: 0 0 0 3px rgba(196, 42, 42, 0.15); }
.dot-attn { background: #b45a00; box-shadow: 0 0 0 3px rgba(180, 90, 0, 0.15); }
.dot-wins { background: #1e6b34; box-shadow: 0 0 0 3px rgba(30, 107, 52, 0.15); }
.today-sec-meta {
  font-size: 11px;
  font-weight: 600;
  color: var(--mute);
  letter-spacing: 0.01em;
}

/* List + card */
.today-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.today-loading {
  padding: 20px;
  text-align: center;
  color: var(--mute);
  font-size: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.today-empty {
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--mute);
  background: rgba(30, 107, 52, 0.05);
  border: 1px solid rgba(30, 107, 52, 0.15);
  border-radius: 14px;
}
.today-empty-icon {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: #1e6b34;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}

/* Card (Today actionable card) */
.today-card {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  transition: box-shadow .15s;
  box-shadow: 0 1px 3px rgba(11, 12, 14, 0.03);
}
.today-card:hover { box-shadow: 0 4px 14px rgba(11, 12, 14, 0.06); }
.today-card-urgent { border-left: 4px solid #c42a2a; }
.today-card-attn { border-left: 4px solid #b45a00; }
.today-card-win { border-left: 4px solid #1e6b34; }

.tc-body {
  padding: 14px 16px;
  background: #fff;
  position: relative;
  z-index: 2;
  transition: transform .24s cubic-bezier(.2,.8,.2,1);
  will-change: transform;
}
.tc-top {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
}
.tc-info { flex: 1; min-width: 0; }
.tc-store {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.tc-meta {
  display: flex;
  gap: 10px;
  margin-top: 3px;
  flex-wrap: wrap;
  align-items: center;
}
.tc-score {
  font-family: var(--display);
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.tc-reason {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--mute);
  letter-spacing: 0.01em;
}
.tc-issue {
  font-size: 12px;
  color: var(--mute);
  margin-top: 5px;
  line-height: 1.45;
  letter-spacing: -0.005em;
}
.tc-rank {
  font-size: 14px;
  flex-shrink: 0;
}

/* Instant Action Buttons */
.tc-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tc-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.005em;
  transition: all .15s;
  cursor: pointer;
  white-space: nowrap;
}
.tc-action:active { transform: scale(0.94); }
.tc-action:hover {
  background: var(--pink-soft);
  border-color: var(--pink);
  color: var(--pink-dk);
}
.tc-action-primary {
  background: linear-gradient(135deg, #EEA3C1 0%, #C76E92 100%);
  color: #fff !important;
  border: 0;
  box-shadow: 0 2px 8px rgba(199, 110, 146, 0.25);
}
.tc-action-primary:hover {
  background: linear-gradient(135deg, #C76E92 0%, #8B3F5F 100%);
  box-shadow: 0 4px 12px rgba(199, 110, 146, 0.35);
}

/* Swipe backgrounds — fill whole card, revealed as body translates */
.today-card.swipeable { touch-action: pan-y; }
.tc-swipe-bg {
  position: absolute;
  top: 0; bottom: 0;
  width: 50%;
  display: flex;
  align-items: center;
  padding: 0 24px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  z-index: 1;
}
.tc-swipe-bg-left {
  left: 0;
  background: linear-gradient(90deg, #1e6b34 0%, #4ea06b 100%);
  justify-content: flex-start;
}
.tc-swipe-bg-right {
  right: 0;
  background: linear-gradient(270deg, #b45a00 0%, #d47a20 100%);
  justify-content: flex-end;
}
.today-card.swipe-committed-right .tc-body {
  transform: translateX(-100%);
  opacity: 0.4;
}
.today-card.swipe-committed-left .tc-body {
  transform: translateX(100%);
  opacity: 0.4;
}

/* Responsive tweaks */
@media (max-width: 480px) {
  .today-hero-title { font-size: 26px; }
  .today-hero-sub { font-size: 13.5px; }
  .today-stats { gap: 8px; }
  .today-stat { padding: 12px 8px; }
  .ts-count { font-size: 26px; }
  .today-sec-head h2 { font-size: 16px; }
  .tc-actions .tc-action { padding: 6px 10px; font-size: 11px; }
}

/* =====================================================
   ⚡ QUICK FIX MODE — stripped-back issue queue
   ===================================================== */
.page-quickfix { background: linear-gradient(180deg, #FAF8F9 0%, #F7F3F5 100%); min-height: 100vh; }
.qf-wrap { max-width: 760px; padding-bottom: 60px; }

.qf-hero { padding: 24px 4px 6px; }
.qf-eyebrow {
  font-size: 10px;
  letter-spacing: 0.22em;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--pink-dk);
  margin-bottom: 10px;
  display: inline-flex;
  align-items: center;
}
.qf-title {
  font-family: var(--display);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.028em;
  line-height: 1.05;
  color: var(--ink);
  margin: 0 0 8px;
}
.qf-sub {
  font-size: 14.5px;
  color: var(--mute);
  line-height: 1.55;
  margin: 0;
}

/* Progress bar */
.qf-progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 14px;
}
.qf-progress {
  flex: 1;
  height: 8px;
  background: rgba(11, 12, 14, 0.06);
  border-radius: 100px;
  overflow: hidden;
}
.qf-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #EEA3C1 0%, #D67FA4 50%, #8C3E5E 100%);
  border-radius: 100px;
  transition: width .4s cubic-bezier(.2,.8,.2,1);
}
.qf-progress-text {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--mute);
  flex-shrink: 0;
}

/* Filter chips */
.qf-filter-row {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.qf-chip {
  padding: 7px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 100px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--mute);
  cursor: pointer;
  transition: all .15s;
  letter-spacing: -0.005em;
}
.qf-chip:hover { border-color: rgba(238, 163, 193, 0.5); color: var(--ink); }
.qf-chip.active {
  background: linear-gradient(135deg, #EEA3C1 0%, #C76E92 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 3px 10px rgba(199, 110, 146, 0.3);
}

/* Issue cards */
.qf-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.qf-card {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  transition: box-shadow .15s;
  box-shadow: 0 1px 3px rgba(11, 12, 14, 0.03);
}
.qf-card:hover { box-shadow: 0 4px 14px rgba(11, 12, 14, 0.06); }
.qf-card-critical { border-left: 4px solid #c42a2a; }
.qf-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.qf-crit-pill {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: #fff;
  background: #c42a2a;
  padding: 3px 7px;
  border-radius: 100px;
}
.qf-cat {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pink-dk);
  background: rgba(238, 163, 193, 0.12);
  padding: 3px 8px;
  border-radius: 100px;
}
.qf-age {
  font-size: 11px;
  font-weight: 600;
  color: var(--mute);
  margin-left: auto;
}
.qf-item {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin-bottom: 5px;
}
.qf-store {
  font-size: 12.5px;
  color: var(--mute);
  margin-bottom: 8px;
  font-weight: 600;
}
.qf-code {
  font-size: 10px;
  font-weight: 700;
  background: rgba(11, 12, 14, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.02em;
  margin-left: 4px;
}
.qf-note {
  font-size: 12px;
  font-style: italic;
  color: var(--mute);
  padding: 8px 10px;
  background: rgba(238, 163, 193, 0.06);
  border-left: 2px solid rgba(238, 163, 193, 0.3);
  border-radius: 0 8px 8px 0;
  margin-bottom: 10px;
  line-height: 1.4;
}

.qf-done {
  padding: 44px 20px;
  text-align: center;
  background: linear-gradient(135deg, rgba(30, 107, 52, 0.06) 0%, rgba(255,255,255,0.8) 100%);
  border: 1px solid rgba(30, 107, 52, 0.2);
  border-radius: 18px;
}
.qf-done-icon { font-size: 38px; margin-bottom: 8px; }
.qf-done-title {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 4px;
}
.qf-done-sub {
  font-size: 13px;
  color: var(--mute);
  line-height: 1.5;
}

@media (max-width: 480px) {
  .qf-title { font-size: 26px; }
  .qf-item { font-size: 14px; }
}

/* =====================================================
   ⚡ MANAGER COACH — PDF ACTION BAR
   ===================================================== */
.mc-plan-actions {
  display: flex;
  gap: 8px;
  margin: 0 0 14px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(253, 246, 250, 0.6) 0%, rgba(255, 255, 255, 0.8) 100%);
  border: 1px solid rgba(238, 163, 193, 0.28);
  border-radius: 14px;
  flex-wrap: wrap;
  align-items: center;
}
.mc-pdf-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 9px 16px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.005em;
  border-radius: 100px;
  cursor: pointer;
  transition: all .18s cubic-bezier(.2,.8,.2,1);
  white-space: nowrap;
  border: 0;
}
.mc-pdf-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}
.mc-pdf-preview {
  background: #fff;
  border: 1px solid rgba(238, 163, 193, 0.45);
  color: var(--pink-dk);
}
.mc-pdf-preview:hover:not(:disabled) {
  background: var(--pink-soft);
  border-color: var(--pink);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(199, 110, 146, 0.15);
}
.mc-pdf-download {
  background: linear-gradient(135deg, #EEA3C1 0%, #C76E92 100%);
  color: #fff;
  box-shadow: 0 3px 10px rgba(199, 110, 146, 0.3);
}
.mc-pdf-download:hover:not(:disabled) {
  background: linear-gradient(135deg, #C76E92 0%, #8B3F5F 100%);
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(199, 110, 146, 0.4);
}
.mc-pdf-spinner {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  border-top-color: transparent;
  animation: ai-spin 0.7s linear infinite;
  margin-right: 3px;
}

/* In-page PDF preview overlay (fallback when popup blocked) */
.mc-pdf-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(11, 12, 14, 0.72);
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: mcPdfOverlayFade 0.18s ease-out;
}
@keyframes mcPdfOverlayFade { from { opacity: 0; } to { opacity: 1; } }
.mc-pdf-overlay-head {
  background: #fff;
  border-bottom: 1px solid rgba(238, 163, 193, 0.28);
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.mc-pdf-overlay-title {
  font-family: var(--display, 'Playfair Display', Georgia, serif);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink, #0B0C0E);
}
.mc-pdf-overlay-actions {
  display: flex;
  gap: 8px;
}
.mc-pdf-overlay-frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #fff;
  min-height: 0;
}

/* =====================================================
   End of v2 elite stylesheet.
   ===================================================== */
