/* =========================================================
   THEME — Rockford Siding & Windows sales dashboard
   Change these variables to retune the whole site's colors.
   ========================================================= */
:root {
  /* Sampled from rockford-siding.com: deep red #89050A / #BF0C14,
     bright red #EC2029, charcoal #333, black #111 */
  --brand:       #89050a;   /* primary (header, buttons)      */
  --brand-dark:  #5f0407;   /* darker shade of primary        */
  --brand-light: #faeaeb;   /* pale tint for highlights       */
  --accent:      #ec2029;   /* accent (CTAs, alerts, badges)  */
  --accent-dark: #bf0c14;
  --ink:         #111111;   /* logo black — active nav, emphasis */
  --ok:          #1e7e34;
  --warn:        #b56a00;
  --bg:          #f6f5f4;
  --card:        #ffffff;
  --line:        #e2dedd;
  --text:        #333333;
  --muted:       #6b7280;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45;
}
a { color: var(--brand); }

/* ---------- Top bar ---------- */
.topbar {
  background: var(--brand); color: #fff;
  display: flex; align-items: center; gap: 16px;
  padding: 0 18px; height: 56px; position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow);
}
.topbar .logo { font-weight: 800; font-size: 16px; letter-spacing: .3px; white-space: nowrap; }
.topbar .logo span { color: #fff; opacity: .75; font-weight: 600; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a {
  color: #fff; text-decoration: none; padding: 8px 12px; border-radius: 8px;
  font-weight: 600; font-size: 14px; opacity: .85;
}
.topbar nav a:hover { background: rgba(255,255,255,.12); opacity: 1; }
.topbar nav a.active { background: var(--ink); opacity: 1; }
.topbar .who { font-size: 13px; opacity: .9; white-space: nowrap; }
.topbar .logout { background: none; border: 1px solid rgba(255,255,255,.4); color: #fff;
  border-radius: 8px; padding: 6px 12px; cursor: pointer; font-size: 13px; }
.topbar .logout:hover { background: rgba(255,255,255,.12); }

.wrap { max-width: 1200px; margin: 0 auto; padding: 22px 18px 60px; }

h1 { font-size: 22px; margin: 4px 0 14px; }
h2 { font-size: 17px; margin: 0 0 10px; }
.sub { color: var(--muted); font-size: 13px; }

/* ---------- Cards & grids ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }

/* ---------- Stat tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; }
.tile .n { font-size: 26px; font-weight: 800; color: var(--brand); line-height: 1.1; }
.tile .l { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.tile.hot .n { color: var(--accent); }

/* ---------- Forms ---------- */
label { display: block; font-size: 13px; font-weight: 600; margin: 10px 0 4px; }
input, select, textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-light); border-color: var(--brand); }
button, .btn {
  display: inline-block; background: var(--brand); color: #fff; border: 0; border-radius: 8px;
  padding: 10px 16px; font-size: 14px; font-weight: 700; cursor: pointer; text-decoration: none;
}
button:hover, .btn:hover { background: var(--brand-dark); }
.btn.accent { background: var(--accent); }
.btn.accent:hover { background: var(--accent-dark); }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--brand-light); }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* number steppers for daily entry */
.kpi-row { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 0; border-bottom: 1px dashed var(--line); }
.kpi-row:last-child { border-bottom: 0; }
.kpi-row .name { font-weight: 600; font-size: 14px; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button { width: 34px; height: 34px; padding: 0; border-radius: 8px; font-size: 18px;
  background: var(--brand-light); color: var(--brand); }
.stepper button:hover { background: var(--line); }
.stepper input { width: 64px; text-align: center; font-weight: 700; font-size: 16px; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); }
tr:hover td { background: var(--brand-light); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Progress bars ---------- */
.prog { background: var(--line); border-radius: 99px; height: 10px; overflow: hidden; }
.prog > i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.prog > i.done { background: var(--ok); }
.goal-row { margin: 10px 0; }
.goal-row .top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }

/* ---------- Badges & misc ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; }
.badge.brand { background: var(--brand-light); color: var(--brand); }
.badge.red { background: #fde8ec; color: var(--accent); }
.badge.green { background: #e6f4ea; color: var(--ok); }
.badge.gray { background: var(--line); color: var(--muted); }
.pill-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.pill-tabs button { background: var(--card); color: var(--text); border: 1px solid var(--line); }
.pill-tabs button.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.muted { color: var(--muted); }
.right { text-align: right; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.mt { margin-top: 14px; } .mb { margin-bottom: 14px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--brand-dark); color: #fff; padding: 10px 18px; border-radius: 8px;
  font-weight: 600; box-shadow: var(--shadow); z-index: 99; opacity: 0; transition: opacity .25s; }
.toast.show { opacity: 1; }
.toast.err { background: var(--accent-dark); }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--brand-dark), var(--brand) 60%, var(--brand-dark)); }
.login-box { width: 360px; max-width: 92vw; background: var(--card); border-radius: 14px;
  padding: 28px; box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.login-box .brandmark { text-align: center; margin-bottom: 6px; font-size: 20px; font-weight: 800; color: var(--brand); }
.login-box .brandmark small { display: block; color: var(--accent); font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 2px; margin-top: 2px; }
.login-err { color: var(--accent); font-size: 13px; font-weight: 600; min-height: 18px; margin-top: 8px; }

/* ---------- Training ---------- */
.module-list .mod { display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.module-list .mod:hover { background: var(--brand-light); }
.module-body { white-space: pre-wrap; }
.module-body h3 { color: var(--brand); margin: 18px 0 6px; font-size: 15px; }
.quiz-q { margin: 14px 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.quiz-q .q { font-weight: 700; margin-bottom: 8px; }
.quiz-q label { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; margin: 6px 0; cursor: pointer; }
.quiz-q input[type=radio] { width: auto; margin-top: 3px; }
.quiz-q.right { border-color: var(--ok); background: #f2faf4; }
.quiz-q.wrong { border-color: var(--accent); background: #fdf3f5; }

/* leaderboard medals */
.medal { font-size: 16px; width: 26px; display: inline-block; }

canvas.chart { width: 100% !important; }
