:root {
  /* Brand colors sampled from LaBonnes.com */
  --brand: #8c0303;        /* LaBonne's red (nav) */
  --brand-dark: #660000;   /* deep red (header) */
  --brand-bright: #a80000; /* accent red */
  --brand-light: #f9ecec;  /* red tint for selected/hover states */
  --gold: #ffcd70;         /* banner gold */
  --gold-dark: #e08a00;
  --gold-light: #fff3dc;
  --gold-text: #7a4f0a;
  /* Semantic rating colors (kept distinct from brand red) */
  --pos: #2e7d4f;
  --pos-dark: #1f5c3a;
  --pos-light: #e6f0ea;
  --amber: #b7791f;
  --amber-light: #fdf3e0;
  --red: #b42318;
  --red-light: #fbe9e7;
  --ink: #1c1c1c;
  --muted: #5f5a56;
  --line: #ddd6cf;
  --paper: #ffffff;
  --bg: #f6f3ee;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 4px 14px rgba(0, 0, 0, 0.05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5rem; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
p { margin: 0 0 0.75rem; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }

/* Top bar */
.topbar {
  background: var(--brand-dark);
  color: #fff;
  padding: 0 16px;
  border-bottom: 3px solid var(--gold);
}
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; font-size: 1rem; padding: 8px 0; }
.brand img { height: 44px; width: auto; display: block; }
.brand span { font-weight: 600; letter-spacing: 0.6px; text-transform: uppercase; font-size: 0.85rem; opacity: 0.9; border-left: 1px solid rgba(255,255,255,0.35); padding-left: 12px; }
.topbar-inner { min-height: 64px; }
.topbar a { color: #fff; }
.topbar .who { font-size: 0.9rem; opacity: 0.95; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 16px 80px;
}
.page.narrow { max-width: 820px; }

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.card h2 { margin-bottom: 0.25rem; }

/* Buttons */
.btn {
  appearance: none;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1.2;
}
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.secondary { background: #fff; color: var(--brand); }
.btn.secondary:hover { background: var(--brand-light); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--brand); padding-left: 8px; padding-right: 8px; }
.topbar .btn.ghost { color: #fff; }
.topbar .btn.ghost:hover { background: rgba(255,255,255,0.12); }
.btn.ghost:hover { background: var(--brand-light); }
.btn.danger { background: #fff; color: var(--red); border-color: var(--red); }
.btn.danger:hover { background: var(--red-light); }
.btn.go { background: var(--pos); border-color: var(--pos); color: #fff; }
.btn.go:hover { background: var(--pos-dark); border-color: var(--pos-dark); }
.btn.large { padding: 14px 22px; font-size: 1.05rem; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Landing */
.hero { padding: 36px 0 12px; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.choice {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  transition: transform 0.1s ease, border-color 0.1s ease;
}
.choice:hover { transform: translateY(-2px); border-color: var(--brand); }
.choice h2 { color: var(--brand-dark); }
.choice .go { font-weight: 600; color: var(--brand); margin-top: 8px; display: inline-block; }

/* Form layout */
.form-header {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
}
@media (max-width: 640px) { .form-header { grid-template-columns: 1fr; } }
.field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.field input, .field textarea, .field select {
  width: 100%;
  font: inherit;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
.field input:focus, .field textarea:focus, .field select:focus, .tile input:focus-visible + span {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
  border-color: var(--brand);
}
.field textarea { min-height: 110px; resize: vertical; }
.field.invalid input, .field.invalid textarea { border-color: var(--red); background: #fff8f7; }
.field .hint { font-size: 0.85rem; color: var(--muted); margin-top: 4px; }

.section {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}
.section.invalid { border-color: var(--red); }
.section-head {
  background: #f5efe6;
  border-bottom: 1px solid var(--line);
  padding: 14px 20px;
}
.section-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
.section-head .scored-badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--gold-text);
  background: var(--gold-light);
  border: 1px solid var(--gold);
  border-radius: 999px;
  padding: 2px 8px;
}
.section-head .optional-badge { color: var(--muted); background: #eeeae4; border-color: var(--line); }
.section-body { padding: 16px 20px 20px; }
.section-body ol { margin: 0 0 12px; padding-left: 1.4rem; }
.section-body ol li { margin-bottom: 2px; }
.section-body p.desc { color: var(--ink); }

/* Rating tiles */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 12px 0 16px; }
.tiles.two { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 420px; }
@media (max-width: 560px) { .tiles { grid-template-columns: 1fr; } .tiles.two { grid-template-columns: 1fr 1fr; } }
.tile { position: relative; display: block; cursor: pointer; }
.tile input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tile span {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
  min-height: 62px;
  transition: border-color 0.1s ease, background 0.1s ease;
}
.tile span b { font-size: 1.05rem; }
.tile span small { color: var(--muted); }
.tile:hover span { border-color: #9aa6b0; }
.tile input:checked + span { border-color: var(--pos); background: var(--pos-light); }
.tile input:checked + span b, .tile input:checked + span small { color: var(--pos-dark); }
.tile.minus input:checked + span { border-color: var(--red); background: var(--red-light); }
.tile.minus input:checked + span b, .tile.minus input:checked + span small { color: var(--red); }
.tile.plusminus input:checked + span { border-color: var(--gold-dark); background: var(--gold-light); }
.tile.plusminus input:checked + span b, .tile.plusminus input:checked + span small { color: var(--gold-text); }

/* Supervisor score panel */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } .score-panel { position: static !important; } }
.score-panel { position: sticky; top: 16px; }
.score-panel textarea { min-height: 130px; font-size: 0.92rem; }
.score-big { font-size: 2.4rem; font-weight: 700; line-height: 1.1; }
.score-big small { font-size: 1rem; font-weight: 500; color: var(--muted); }
.outcome { border-radius: 8px; padding: 10px 12px; margin-top: 10px; font-weight: 600; }
.outcome.raise { background: var(--pos-light); color: var(--pos-dark); }
.outcome.action { background: var(--red-light); color: var(--red); }
.outcome.incomplete { background: #eeeae4; color: var(--muted); }
.outcome .why { display: block; font-weight: 400; font-size: 0.9rem; margin-top: 2px; }
.score-list { list-style: none; padding: 0; margin: 12px 0 0; font-size: 0.92rem; }
.score-list li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.score-list li span:last-child { font-weight: 600; }
.score-list .pending { color: var(--muted); font-weight: 400; }
.matrix { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin-top: 12px; }
.matrix th, .matrix td { text-align: left; padding: 4px 6px; border-top: 1px solid var(--line); }
.matrix th { color: var(--muted); font-weight: 600; border-top: none; }

.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
@media (max-width: 560px) { .metrics { grid-template-columns: 1fr; } }
.metric { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.metric .label { font-weight: 600; margin-bottom: 6px; }
.metric .yn { display: flex; gap: 12px; }
.metric .yn label { display: flex; gap: 6px; align-items: center; cursor: pointer; }

/* Action bar */
.actionbar {
  position: sticky;
  bottom: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(6px);
  border-top: 1px solid var(--line);
  padding: 12px 16px;
  margin: 0 -16px;
}
.actionbar-inner { max-width: 1100px; margin: 0 auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.status-text { font-size: 0.9rem; color: var(--muted); }

/* Alerts */
.alert { border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; border: 1px solid transparent; }
.alert.error { background: var(--red-light); border-color: #f1b6b0; color: var(--red); }
.alert.success { background: var(--pos-light); border-color: #b7d3c2; color: var(--pos-dark); }
.alert.info { background: #eef4fb; border-color: #c6d8ee; color: #1f3d63; }
.alert ul { margin: 6px 0 0; padding-left: 1.2rem; }
.alert a { color: inherit; }

/* Tables (dashboard) */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
table.list th, table.list td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list td.actions { text-align: right; }
table.list td.actions .btn { margin: 2px 0 2px 4px; }
.btn.ghost.discard { color: var(--red); }
.btn.ghost.discard:hover { background: var(--red-light); }
table.list th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); }
table.list tr:hover td { background: #faf7f2; }
.pill { display: inline-block; font-size: 0.75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.pill.draft { background: #eeeae4; color: var(--muted); }
.pill.complete { background: var(--pos-light); color: var(--pos-dark); }
.pill.action { background: var(--red-light); color: var(--red); }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab { background: none; border: none; font: inherit; font-weight: 600; padding: 10px 14px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab { text-transform: uppercase; letter-spacing: 0.4px; font-size: 0.85rem; }
.tab.active { color: var(--brand); border-bottom-color: var(--gold-dark); }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

.login-box { max-width: 460px; margin: 40px auto; }
.divider { border: none; border-top: 1px solid var(--line); margin: 16px 0; }
code.ref { background: #eeeae4; padding: 2px 6px; border-radius: 4px; font-size: 0.9rem; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(28, 28, 28, 0.45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 100; }
.modal { background: var(--paper); border-radius: var(--radius); box-shadow: 0 10px 40px rgba(0,0,0,0.25); padding: 22px; max-width: 460px; width: 100%; }
.modal h2 { margin-bottom: 8px; }
.modal p { color: var(--ink); }
.modal-actions { justify-content: flex-end; margin-top: 16px; }
.btn.danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger-solid:hover { background: #8f1a12; border-color: #8f1a12; }

/* Change history */
.log-entry { border-top: 1px solid var(--line); padding: 10px 0 4px; }
.log-entry ul { margin: 4px 0 0; padding-left: 1.2rem; color: var(--muted); font-size: 0.92rem; }
.log-score { color: var(--brand); font-weight: 600; }

.btn.google { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.google:hover { background: #f6f3ee; border-color: #b8afa6; }

.filters { margin: -6px 0 14px; gap: 16px; }
.filters label { display: flex; align-items: center; gap: 6px; }
.filters select { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.user-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.user-row .meta { font-size: 0.85rem; color: var(--muted); }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; }
.switch input { width: 18px; height: 18px; accent-color: var(--brand); }
