:root {
  /* Colour tokens — Nameinator's signature colour is yellow; everything else is
     copied verbatim from Docinator per the Design Constitution §3a. */
  --primary-color: #FBC02D;
  --primary-hover: #F9A825;
  --secondary-color: #95a5a6;
  --secondary-hover: #7f8c8d;
  --success-color: #34A853;
  --success-hover: #2e8a4a;
  --danger-color: #e74c3c;
  --danger-hover: #c0392b;
  --text-dark: #2c3e50;
  --text-light: #34495e;
  --text-muted: #8b929a;
  --input-bg: #ecf0f1;
  --container-bg-color: #ffffff;
  --main-bg-color: #f0f2f5;
  --gradient-start: #FFFDE7;
  --gradient-end: #fdfefe;
  --border-soft: #d5deec;
  --border-input: #ccc;
  --font-sans: 'Google Sans', 'Roboto Flex', 'Inter', 'Roboto', 'Segoe UI', sans-serif;

  /* Structural tokens — fixed across the whole TeachSmarts family */
  --radius-input: 8px;
  --radius-button: 8px;
  --radius-card: 16px;
  --radius-modal: 18px;
  --radius-pill: 999px;

  --space-xs: 6px;
  --space-sm: 10px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  --control-height: 44px;
  --width-app-max: 960px;
  --width-wizard-max: 900px;
  --width-landing-max: 1320px;
  --width-legal-max: 860px;

  --shadow-card: 0 12px 36px rgba(0,0,0,.08);
  --shadow-card-soft: 0 4px 20px rgba(0,0,0,.06);
  --shadow-hover-lift: 0 6px 14px rgba(0,0,0,.08);
  --shadow-modal: 0 28px 80px rgba(15,23,42,.28);

  --font-size-page-title: 2rem;
  --font-size-section: 1.5rem;
  --font-size-card-title: 1.125rem;
  --font-size-body: 1rem;
  --font-size-control: 1em;
  --font-size-helper: 0.875rem;

  --transition-fast: 0.2s ease;
  --transition-lift: 0.15s ease;

  --z-dropdown: 10;
  --z-sticky-nav: 100;
  --z-modal: 9999;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text-dark);
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  min-height: 100vh;
}

.hidden { display: none !important; }

a { color: var(--primary-color); }

/* ---- Page frame / app container (Layout Model) ---- */

.page-frame { min-height: 100vh; display: flex; flex-direction: column; }

.app-container {
  background: var(--container-bg-color);
  border: 1px solid rgba(15,23,42,.08);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: var(--space-lg);
  max-width: var(--width-app-max);
  margin: 30px auto;
  width: calc(100% - 40px);
}

@media (max-width: 768px) {
  .app-container { padding: var(--space-md); border-radius: var(--radius-card); }
}

#user-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding-bottom: var(--space-md);
  margin-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-soft);
}
#user-info .user-identity { display: flex; align-items: center; gap: var(--space-sm); color: var(--text-light); font-size: var(--font-size-helper); }
#user-info .user-avatar { width: 32px; height: 32px; border-radius: var(--radius-pill); background: var(--input-bg); }

#usage-info { font-size: var(--font-size-helper); color: var(--text-muted); margin-bottom: var(--space-md); }

/* ---- Buttons ---- */

.btn {
  background: var(--primary-color);
  color: var(--text-dark);
  font-weight: bold;
  font-size: 1em;
  font-family: var(--font-sans);
  border: none;
  border-radius: var(--radius-button);
  padding: 15px 30px;
  min-height: var(--control-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  cursor: pointer;
  transition: background-color var(--transition-fast);
}
.btn:hover:not([disabled]) { background: var(--primary-hover); }
.btn[disabled] { background: #bdc3c7; cursor: not-allowed; }

.btn.btn-secondary { background: var(--secondary-color); color: #fff; }
.btn.btn-secondary:hover:not([disabled]) { background: var(--secondary-hover); }

.btn.btn-outline { background: transparent; border: 2px solid var(--primary-color); color: var(--primary-hover); }
.btn.btn-outline:hover:not([disabled]) { background: var(--gradient-start); }

.btn.btn-compact { padding: var(--space-sm) var(--space-md); min-height: 36px; font-size: var(--font-size-helper); }

.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: stretch;
  width: 100%;
}

.group-label { display: block; font-weight: 600; color: var(--text-light); margin-bottom: var(--space-xs); font-size: var(--font-size-helper); text-transform: uppercase; letter-spacing: .02em; }

.selectable-btn {
  background: var(--input-bg);
  color: var(--text-light);
  border: 2px solid #bdc3c7;
  border-radius: var(--radius-button);
  padding: var(--space-lg);
  text-align: center;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: var(--font-size-control);
  flex: 1;
  min-width: 140px;
  transition: all var(--transition-fast);
}
.selectable-btn:hover { border-color: var(--primary-color); }
.selectable-btn.checked { background: var(--primary-color); color: var(--text-dark); border-color: var(--primary-hover); }
.selectable-btn.compact { padding: var(--space-sm) var(--space-md); min-width: auto; }

/* ---- Increment control ---- */

.increment-control { display: inline-flex; align-items: center; gap: var(--space-sm); }
.increment-btn {
  width: 36px; height: 36px; border-radius: var(--radius-button); border: 2px solid var(--border-input);
  background: var(--input-bg); color: var(--text-dark); font-size: 1.1em; font-weight: bold; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; transition: all var(--transition-fast);
}
.increment-btn:hover:not([disabled]) { border-color: var(--primary-color); color: var(--primary-color); }
.increment-btn[disabled] { opacity: .4; cursor: not-allowed; }
.increment-value { min-width: 48px; text-align: center; font-size: 1.1em; font-weight: 600; color: var(--text-dark); }

/* ---- Inputs ---- */

input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
  width: 100%;
  padding: 15px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-input);
  background: var(--input-bg);
  font-size: var(--font-size-body);
  font-family: var(--font-sans);
  color: var(--text-dark);
}
textarea { min-height: 120px; resize: vertical; }
input[type="color"] { width: 56px; height: var(--control-height); padding: 4px; border: 1px solid var(--border-input); border-radius: var(--radius-input); background: var(--input-bg); cursor: pointer; }

.form-group { margin-bottom: var(--space-md); }
.form-group label { display: block; font-weight: 600; color: var(--text-light); margin-bottom: var(--space-xs); font-size: var(--font-size-helper); }

.input-with-clear { position: relative; display: flex; align-items: center; gap: var(--space-sm); }
.clear-btn {
  width: 28px; height: 28px; border-radius: var(--radius-pill); border: none; background: var(--danger-color);
  color: #fff; cursor: pointer; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
}
.clear-btn:hover { background: var(--danger-hover); }

/* ---- Status box ---- */

.status-box {
  margin-top: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-input);
  text-align: center;
  font-size: 1.1em;
}
.status-box.error { background: #fdedec; border: 1px solid #fadbd8; color: var(--danger-hover); }
.status-box.info { background: #eef3fb; border: 1px solid var(--border-soft); color: var(--text-light); }
.status-box.success { background: #eaf7ee; border: 1px solid #cdeeda; color: var(--success-hover); }

/* ---- Wizard ---- */

.wizard-page { display: none; width: 100%; padding: var(--space-md) var(--space-sm); }
.wizard-page.active { display: block; animation: fadeIn .5s; }
.wizard-page.center-content { max-width: var(--width-wizard-max); margin: 0 auto; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.step-title { font-size: var(--font-size-page-title); margin: 0 0 var(--space-lg); color: var(--text-dark); }

.wizard-nav-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: var(--space-xl); padding-top: var(--space-lg); border-top: 1px solid var(--border-soft);
}

/* ---- Upload dropzone ---- */

.dropzone {
  border: 2px dashed var(--border-input); border-radius: var(--radius-input);
  padding: var(--space-2xl) var(--space-lg); text-align: center; color: var(--text-light);
  cursor: pointer; transition: all var(--transition-fast); background: var(--input-bg);
}
.dropzone:hover, .dropzone.dragover { border-color: var(--primary-color); background: #fffbea; }
.dropzone .dz-icon { font-size: 2.5rem; margin-bottom: var(--space-sm); }

/* ---- Placement canvas ---- */

.placement-workspace { display: flex; gap: var(--space-lg); flex-wrap: wrap; }
.placement-preview {
  position: relative; flex: 1 1 420px; min-height: 300px; background: var(--input-bg);
  border-radius: var(--radius-input); border: 1px solid var(--border-soft); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.placement-preview canvas { max-width: 100%; display: block; }
.page-surface {
  position: relative; background: #fff; box-shadow: var(--shadow-card-soft);
  width: 90%; max-height: 90%; margin: auto;
}
.page-surface img { width: 100%; height: 100%; object-fit: contain; display: block; }
.name-tag {
  position: absolute; cursor: grab; padding: 2px 6px; border-radius: 4px;
  background: rgba(251,192,45,.18); border: 1px dashed var(--primary-color);
  white-space: nowrap; user-select: none; touch-action: none;
}
.name-tag:active { cursor: grabbing; }
.placement-controls { flex: 1 1 260px; display: flex; flex-direction: column; gap: var(--space-md); }

/* ---- Confirmation grid ---- */

.confirmation-grid {
  overflow-y: auto; max-height: 60vh;
  padding: 0 var(--space-sm); margin: 0 calc(var(--space-sm) * -1);
  scrollbar-width: none;
}
.confirmation-grid::-webkit-scrollbar { display: none; }
.confirm-row { display: flex; justify-content: space-between; align-items: center; padding: 18px 5px; border-bottom: 1px solid var(--border-soft); }
.confirm-row:last-child { border-bottom: none; }
.confirm-row p { margin: 0; font-size: 1.1em; color: var(--text-dark); flex: 1; text-align: left; }
.confirm-row strong { color: var(--text-light); }
.edit-btn { background: none; border: none; color: var(--primary-color); font-weight: bold; font-size: .9em; text-decoration: underline; padding: 5px; cursor: pointer; }

/* ---- Progress ---- */

.progress-track { width: 100%; height: 12px; border-radius: var(--radius-pill); background: var(--input-bg); overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary-color); transition: width var(--transition-fast); border-radius: var(--radius-pill); }
.progress-message { margin-top: var(--space-sm); color: var(--text-light); font-size: var(--font-size-helper); text-align: center; }

/* ---- Roster list ---- */

.roster-list { max-height: 320px; overflow-y: auto; border: 1px solid var(--border-soft); border-radius: var(--radius-input); }
.roster-row { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-sm) var(--space-md); border-bottom: 1px solid var(--border-soft); }
.roster-row:last-child { border-bottom: none; }
.roster-row:hover { background: var(--input-bg); }

/* ---- Modal ---- */

.modal-overlay {
  position: fixed; inset: 0; z-index: var(--z-modal); background: rgba(17,24,39,.42);
  backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; padding: var(--space-lg);
}
.modal-card {
  background: #fff; border-radius: var(--radius-modal); box-shadow: var(--shadow-modal);
  padding: var(--space-lg); max-height: 88vh; overflow-y: auto; width: min(480px, 100%);
  position: relative; border-top: 6px solid var(--primary-color);
}
.modal-close-btn {
  position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border: none;
  background: transparent; color: var(--text-light); font-size: 1.3rem; border-radius: var(--radius-pill); cursor: pointer;
}
.modal-close-btn:hover { background: var(--input-bg); }
.modal-title { margin: 0 0 10px; font-size: 1.5rem; font-weight: 700; color: var(--text-dark); text-align: center; }
.modal-copy { margin: 0; color: var(--text-light); font-size: 1.05rem; line-height: 1.6; text-align: center; }
.modal-actions { display: flex; justify-content: center; gap: var(--space-sm); margin-top: var(--space-lg); }
.modal-actions .btn { min-width: 160px; }

/* ---- Landing ---- */

.landing-header { padding: 24px 40px; display: flex; justify-content: space-between; align-items: center; width: 100%; }
.landing-brand { font-size: 1.25rem; font-weight: 700; color: var(--text-dark); }
.landing-container { max-width: var(--width-landing-max); margin: 0 auto; padding: 40px; display: flex; gap: 50px; align-items: center; flex-wrap: wrap; }
.landing-left { flex: 1 1 400px; display: flex; flex-direction: column; align-items: center; padding-right: 40px; text-align: center; }
.landing-right { flex: 1 1 400px; display: flex; flex-direction: column; gap: var(--space-md); align-items: flex-start; padding-left: 40px; }
.landing-logo { width: 350px; max-width: 100%; aspect-ratio: 1 / 1; height: auto; border-radius: var(--radius-card); object-fit: cover; display: block; margin: 0 auto var(--space-md); }
.landing-product-name { font-size: var(--font-size-page-title); font-weight: 700; color: var(--text-dark); margin: 0; text-align: center; }
.landing-tagline { font-size: 1.5rem; margin: var(--space-sm) 0 var(--space-lg); color: var(--text-light); text-align: center; }

.landing-section-heading { font-size: var(--font-size-section); font-weight: 700; color: var(--text-dark); margin: 0; }

.feature-box {
  background: #fff; border-radius: var(--radius-input); padding: var(--space-md) var(--space-lg);
  box-shadow: var(--shadow-card-soft); font-size: 1.1rem; width: 100%;
  transition: transform var(--transition-lift), box-shadow var(--transition-lift);
}
.feature-box:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover-lift); }
.feature-box h3 { margin: 0 0 var(--space-xs); font-size: var(--font-size-card-title); color: var(--text-dark); }
.feature-box p { margin: 0; color: var(--text-light); font-size: var(--font-size-helper); }

.auth-toggle { background: none; border: none; color: var(--primary-color); text-decoration: underline; cursor: pointer; font-size: var(--font-size-helper); padding: var(--space-xs); }

footer.landing-footer { text-align: center; color: var(--text-muted); font-size: .75rem; padding: 16px 40px 24px; }
footer.landing-footer a { color: var(--text-muted); text-decoration: underline; margin: 0 6px; }

@media (max-width: 768px) {
  .landing-header { padding: 20px; }
  .landing-container { padding: 20px; flex-direction: column; }
  .landing-left, .landing-right { padding: 0; }
  footer.landing-footer { padding: 16px 20px 24px; }
}

/* ---- Legal pages ---- */

.legal-header { display: flex; justify-content: space-between; align-items: center; padding: 24px 40px; }
.legal-card { max-width: var(--width-legal-max); margin: 0 auto 40px; background: #fff; padding: 40px 44px 48px; border-radius: var(--radius-card); box-shadow: var(--shadow-card-soft); }
.legal-card h1 { font-size: 2rem; }
.legal-card h2 { font-size: 1.25rem; }
.legal-card h3 { font-size: 1.05rem; }
.legal-card p, .legal-card li { font-size: 1rem; line-height: 1.6; color: var(--text-light); }
@media (max-width: 640px) {
  .legal-header { padding: 20px; }
  .legal-card { margin: 0 16px 40px; }
}
