:root {
  --cream: #faf6ef;
  --cream-2: #f1ead9;
  --espresso: #3a2418;
  --crema: #c9a26b;
  --crema-dark: #a07a44;
  --accent: #8b3a2b;
  --accent-dark: #6b2a1f;
  --success: #4a7c4e;
  --muted: #8a7a68;
  --border: #d9cfba;
  --shadow: 0 6px 18px rgba(58, 36, 24, 0.08);
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--espresso);
  font-family: 'Georgia', 'Cambria', 'Times New Roman', serif;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  background: var(--espresso);
  color: var(--cream);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
}

.site-header .brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--cream);
}

.site-header .brand:hover {
  text-decoration: none;
}

.site-header .brand-logo {
  height: 64px;
  width: 64px;
  display: block;
  background: #fff;
  border-radius: 50%;
  padding: 4px;
  box-sizing: border-box;
}

.site-header .brand-text {
  font-size: 1.4rem;
  letter-spacing: 0.5px;
}

.site-header .brand small {
  color: var(--crema);
  font-size: 0.85rem;
  margin-left: 10px;
  font-style: italic;
}

.site-header .employee-tag {
  font-size: 0.9rem;
  color: var(--crema);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

h1, h2, h3 {
  font-family: 'Georgia', serif;
  color: var(--espresso);
  margin-top: 0;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; }

.subtitle {
  color: var(--muted);
  margin-top: -8px;
  margin-bottom: 28px;
}

/* ======== Card grid (index + barista) ======== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.category-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: block;
  color: inherit;
  text-decoration: none;
  position: relative;
}

.category-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(58, 36, 24, 0.14);
  text-decoration: none;
}

.category-card.disabled {
  pointer-events: none;
  cursor: not-allowed;
  background: #ececec;
  border-color: #d0d0d0;
  color: #8a8a8a;
  box-shadow: none;
}

.category-card.disabled:hover {
  transform: none;
  box-shadow: none;
}

.category-card.disabled h2,
.category-card.disabled .meta {
  color: #8a8a8a;
}

.category-card .badge {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--crema);
  color: var(--espresso);
  font-size: 0.72rem;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.category-card.disabled .badge {
  background: #9a9a9a;
  color: #fff;
}

.category-card h2 {
  margin: 0 0 6px;
}

.category-card .meta {
  color: var(--muted);
  font-size: 0.92rem;
}

/* ======== Barista module list ======== */
.progress-strip {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.progress-strip .stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.progress-strip .stat .label {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.progress-strip .stat .value {
  font-size: 1.25rem;
  font-weight: bold;
  color: var(--espresso);
}

.progress-bar {
  height: 10px;
  background: var(--cream-2);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar > .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--crema), var(--accent));
  width: 0%;
  transition: width 0.3s ease;
}

.module-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.module-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
}

.module-card:hover {
  background: var(--cream-2);
  text-decoration: none;
}

.module-card .num {
  font-size: 1.1rem;
  color: var(--crema-dark);
  font-weight: bold;
  min-width: 32px;
}

.module-card .title {
  flex: 1;
  font-size: 1.05rem;
}

.status-pill {
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--cream-2);
  color: var(--muted);
  white-space: nowrap;
}
.status-pill.watched { background: #e7d8b8; color: var(--crema-dark); }
.status-pill.passed  { background: #d6e8d7; color: var(--success); }
.status-pill.scored  { background: #f4e0dc; color: var(--accent); }
.status-pill.locked  { background: var(--muted); color: #fff; }

.module-card.locked {
  opacity: 0.6;
  background: var(--cream-2);
  cursor: not-allowed;
  color: var(--muted);
}
.module-card.locked:hover { background: var(--cream-2); }

/* ======== Buttons ======== */
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 22px;
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease;
  text-decoration: none;
}

.btn:hover { background: var(--accent-dark); text-decoration: none; }

.btn:disabled,
.btn.disabled {
  background: var(--muted);
  cursor: not-allowed;
  opacity: 0.7;
}

.btn.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn.secondary:hover { background: var(--accent); color: #fff; }

.btn.large {
  padding: 16px 32px;
  font-size: 1.1rem;
}

.cert-cta {
  margin-top: 28px;
  text-align: center;
  padding: 22px;
  background: #fff;
  border: 1px dashed var(--crema);
  border-radius: var(--radius);
}

.cert-cta .hint {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ======== Module / Player ======== */
.module-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.video-wrap {
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.video-wrap video {
  display: block;
  width: 100%;
  height: auto;
}

.quiz-section {
  margin-top: 28px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.quiz-section.locked {
  text-align: center;
  color: var(--muted);
  background: var(--cream-2);
  border-style: dashed;
}

.quiz-section.locked .lock-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 8px;
}

.quiz-question {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.quiz-question:last-of-type {
  border-bottom: none;
  margin-bottom: 8px;
}

.quiz-question .q-text {
  font-weight: bold;
  margin-bottom: 10px;
}

.quiz-question label {
  display: block;
  padding: 8px 12px;
  margin: 4px 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.1s ease;
}

.quiz-question label:hover { background: var(--cream-2); }

.quiz-question input[type="radio"] { margin-right: 8px; }

.quiz-question.correct label.chosen {
  background: #d6e8d7;
  border-color: var(--success);
}

.quiz-question.incorrect label.chosen {
  background: #f4dcdc;
  border-color: var(--accent);
}

.quiz-question label.answer-key {
  background: #d6e8d7;
  border-color: var(--success);
  font-weight: bold;
}

.quiz-result {
  text-align: center;
  padding: 18px;
  margin-top: 14px;
  border-radius: var(--radius);
  background: var(--cream-2);
  font-size: 1.1rem;
}

/* ======== Modal (onboarding) ======== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(58, 36, 24, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: var(--cream);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal h2 { margin-top: 0; }

.modal label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 14px;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.modal input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
}

.modal .err {
  color: var(--accent);
  font-size: 0.85rem;
  margin-top: 8px;
  min-height: 1.2em;
}

.modal .modal-actions {
  margin-top: 18px;
  text-align: right;
}

/* ======== Onboarding documents ======== */
.doc-intro {
  background: var(--cream-2);
  border-left: 3px solid var(--crema);
  padding: 12px 16px;
  border-radius: 6px;
  margin: 0 0 18px;
  color: var(--espresso);
}

.pdf-wrap {
  background: #2a2a2a;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  position: relative;
}

.pdf-wrap iframe {
  display: block;
  width: 100%;
  height: 70vh;
  min-height: 520px;
  border: 0;
  background: #fff;
}

.pdf-wrap .pdf-fallback {
  margin: 0;
  padding: 8px 14px;
  background: var(--espresso);
  color: var(--cream);
  font-size: 0.85rem;
  text-align: center;
}
.pdf-wrap .pdf-fallback a {
  color: var(--crema);
  text-decoration: underline;
}

.form-field {
  margin-bottom: 14px;
}

.form-field label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: var(--espresso);
}

.form-field textarea { resize: vertical; min-height: 70px; }

.ack-block {
  margin: 18px 0 18px;
  padding: 14px;
  background: var(--cream-2);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.ack-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.ack-checkbox input[type="checkbox"] {
  margin-top: 4px;
  transform: scale(1.2);
  flex-shrink: 0;
}

.sig-block {
  margin-top: 8px;
}

.sig-label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sig-pad-wrap {
  border: 2px dashed var(--crema);
  border-radius: 6px;
  background: #fff;
  position: relative;
  overflow: hidden;
}

.sig-pad-wrap::before {
  content: "Sign here";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--border);
  font-style: italic;
  font-size: 1.2rem;
  pointer-events: none;
}

#sigPad {
  display: block;
  width: 100%;
  height: 200px;
  touch-action: none;
  cursor: crosshair;
  position: relative;
  z-index: 1;
}

.sig-actions {
  margin-top: 8px;
  text-align: right;
}

.sign-actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.signed-sig-img {
  display: block;
  max-width: 100%;
  width: 360px;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  margin: 12px 0;
}

.quiz-result.incorrect {
  background: #f4dcdc;
  color: var(--accent-dark);
  text-align: left;
}

.signed-banner {
  background: #d6e8d7;
  color: #2f5d33;
  border: 1px solid #b6d3b8;
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 14px;
  font-size: 0.95rem;
}

/* ======== Admin / Manager Dashboard ======== */
.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}
.admin-toolbar h1 { margin: 0; }

.card-block {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.card-block h2 { margin-top: 0; }

.card-block label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 14px;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.card-block input[type="text"],
.card-block input[type="email"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
}
.card-block .err {
  color: var(--accent);
  font-size: 0.9rem;
  margin: 10px 0 0;
  min-height: 1em;
}
.card-block .form-actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
}

.section-checkboxes {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  background: #fff;
  max-height: 260px;
  overflow-y: auto;
}
.section-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--cream-2);
  cursor: pointer;
}
.section-check:last-child { border-bottom: none; }
.section-check input[type="checkbox"] {
  margin-top: 4px;
  transform: scale(1.1);
  flex-shrink: 0;
}

.link-box {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}
.link-box input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 0.9rem;
  background: var(--cream-2);
}

.assignments-table-wrap {
  overflow-x: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.assignments-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.assignments-table th {
  text-align: left;
  background: var(--cream-2);
  padding: 12px 14px;
  font-weight: bold;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.assignments-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--cream-2);
  vertical-align: top;
}
.assignments-table tr:last-child td { border-bottom: none; }
.assignments-table .small { font-size: 0.82rem; }
.muted { color: var(--muted); }
.btn.small { padding: 6px 12px; font-size: 0.9rem; }

.progress-mini {
  width: 80px;
  height: 6px;
  background: var(--cream-2);
  border-radius: 999px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}
.progress-mini > .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--crema), var(--accent));
  width: 0%;
}

.drill-section {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.drill-section h2 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 1.2rem;
}
.drill-modules {
  list-style: none;
  padding: 0;
  margin: 0;
}
.drill-modules li {
  display: grid;
  grid-template-columns: 32px 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--cream-2);
}
.drill-modules li:last-child { border-bottom: none; }
.drill-modules .num { color: var(--crema-dark); font-weight: bold; }
.drill-modules .title { font-size: 0.98rem; }

.drill-sig-thumb {
  grid-column: 1 / -1;
  max-width: 240px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  margin-top: 6px;
}

.drill-sig-link {
  grid-column: 1 / -1;
  margin-top: 6px;
  display: inline-block;
  color: var(--accent);
  font-size: 0.95rem;
  text-decoration: underline;
  width: max-content;
}

.drill-form-values {
  grid-column: 1 / -1;
  margin: 8px 0 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 16px;
  row-gap: 4px;
  background: var(--cream-2);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.92rem;
}
.drill-form-values dt {
  color: var(--muted);
  font-weight: bold;
}
.drill-form-values dd {
  margin: 0;
  color: var(--espresso);
  white-space: pre-wrap;
  word-break: break-word;
}

.preview-banner {
  background: #fff7e0;
  border: 1px solid #e9d39a;
  color: #6b4a00;
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 18px;
  font-size: 0.95rem;
}

.page-nav {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.page-nav #pageIndicator {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.calibrate-stage {
  margin: 18px 0;
}
.calibrate-stage .canvas-wrap {
  position: relative;
  display: inline-block;
  border: 1px solid var(--border);
  background: #fff;
  user-select: none;
  cursor: crosshair;
  box-shadow: var(--shadow);
}
.calibrate-stage canvas {
  display: block;
}
.sig-box-overlay {
  position: absolute;
  border: 2px solid var(--accent);
  background: rgba(139, 58, 43, 0.18);
  pointer-events: none;
  box-sizing: border-box;
}
.sig-box-current {
  position: absolute;
  border: 2px dashed var(--crema);
  background: rgba(201, 162, 107, 0.12);
  pointer-events: none;
  box-sizing: border-box;
}

/* Stamp type colors — used by both the radio picker, the canvas
   overlays, and the stamps list. */
.stamp-type-signature { --stamp-color: #8b3a2b; --stamp-fill: rgba(139, 58, 43, 0.18); }
.stamp-type-name      { --stamp-color: #1a5fa0; --stamp-fill: rgba( 26, 95,160, 0.18); }
.stamp-type-date      { --stamp-color: #2f7a3a; --stamp-fill: rgba( 47,122, 58, 0.18); }

.stamp-type-picker {
  margin-top: 12px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.stamp-radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 2px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.95rem;
  background: #fff;
}
.stamp-radio input { accent-color: var(--stamp-color); }
.stamp-radio:has(input:checked) {
  border-color: var(--stamp-color);
  background: var(--stamp-fill);
  color: var(--stamp-color);
  font-weight: bold;
}

.stamp-overlay {
  position: absolute;
  border: 2px solid var(--stamp-color);
  background: var(--stamp-fill);
  pointer-events: none;
  box-sizing: border-box;
}
.stamp-overlay-tag {
  position: absolute;
  top: -1px;
  left: -1px;
  background: var(--stamp-color);
  color: #fff;
  font-size: 0.72rem;
  padding: 1px 6px;
  border-radius: 0 0 4px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stamps-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.stamps-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--stamp-color);
  border-radius: 6px;
  margin-bottom: 6px;
  background: #fff;
}
.stamp-list-label {
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--stamp-color);
  font-weight: bold;
  letter-spacing: 0.5px;
}
.stamps-list-item .btn { margin-left: auto; }
.stamps-list-item .btn + .btn { margin-left: 0; }

.json-output {
  background: var(--cream-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 0.92rem;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 8px 0;
}

.ack-quote {
  margin: 0;
  padding: 12px 16px;
  background: var(--cream-2);
  border-left: 3px solid var(--crema);
  border-radius: 6px;
  color: var(--espresso);
  font-style: italic;
}

.no-link-state {
  text-align: center;
  padding: 80px 24px;
}
.no-link-state h1 {
  font-size: 2rem;
  margin-bottom: 12px;
}
.no-link-state .subtitle {
  font-size: 1.1rem;
  margin-bottom: 18px;
}
.no-link-state .hint {
  color: var(--accent);
  font-size: 0.95rem;
  margin-top: 24px;
}

/* ======== Misc ======== */
.back-link {
  font-size: 0.95rem;
  color: var(--muted);
}

.back-link:hover { color: var(--accent); }

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 24px;
}
