:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --ink: #182033;
  --muted: #697089;
  --line: #e5e8f2;
  --purple: #7c3aed;
  --blue: #00c4cc;
  --pink: #ff5c9a;
  --shadow: 0 24px 70px rgba(31, 41, 71, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, Arial, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  padding: 28px;
  place-items: center;
  background:
    radial-gradient(circle at 18% 14%, rgba(0, 196, 204, 0.28), transparent 24%),
    radial-gradient(circle at 86% 22%, rgba(255, 92, 154, 0.28), transparent 26%),
    linear-gradient(135deg, #111827, #2b1055);
}

.login-screen.hidden,
.auth-hidden {
  display: none !important;
}

.login-card {
  width: min(520px, 100%);
  padding: 38px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 34px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 34px 100px rgba(0, 0, 0, 0.35);
}

.login-brand {
  display: flex;
  width: 190px;
  height: 190px;
  margin: 0 auto 28px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(203, 161, 47, 0.32);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 18px 42px rgba(203, 161, 47, 0.16);
}

.login-brand img {
  display: block;
  width: 150px;
  height: auto;
  object-fit: contain;
}

.login-card h1 {
  margin: 18px 0 12px;
  color: var(--ink);
  font-size: clamp(2.2rem, 6vw, 4rem);
  line-height: 0.98;
  letter-spacing: -0.06em;
}

.login-card p {
  color: var(--muted);
  line-height: 1.6;
}

.auth-form {
  display: none;
  gap: 12px;
  margin-top: 18px;
  width: 100%;
  max-width: 100%;
}

.auth-form.active {
  display: grid;
}

.auth-form label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-weight: 800;
}

.auth-form input {
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  outline: 0;
}

.login-card .form-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  width: 100%;
}

.auth-form button {
  border: 0;
  border-radius: 14px;
  padding: 13px 14px;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: #fff;
  font-weight: 900;
}

.auth-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 14px;
}

.auth-links button {
  border: 0;
  background: transparent;
  color: var(--purple);
  font-weight: 900;
}

.auth-links span {
  color: var(--muted);
}

.auth-links .back-login {
  display: none;
  margin-left: auto;
  color: var(--muted);
}

.login-card.register-mode .auth-links button[data-auth-switch="register"],
.login-card.forgot-mode .auth-links button[data-auth-switch="forgot"],
.login-card.register-mode .auth-links span,
.login-card.forgot-mode .auth-links span {
  display: none;
}

.login-card.register-mode .back-login,
.login-card.forgot-mode .back-login {
  display: inline;
}

.google-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 14px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.google-divider::before,
.google-divider::after {
  flex: 1;
  height: 1px;
  background: var(--line);
  content: "";
}

#googleButton {
  min-height: 44px;
}

.google-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(31, 41, 71, 0.08);
}

.login-warning {
  margin: 14px 0 0;
  color: #b45309 !important;
  font-size: 0.9rem;
  font-weight: 700;
}

.demo-login {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.demo-login button {
  border: 0;
  border-radius: 14px;
  padding: 12px;
  background: #edf0f8;
  color: var(--ink);
  font-weight: 900;
}

.demo-login button:first-child {
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: #fff;
}

.app-shell {
  display: grid;
  grid-template-columns: 76px 340px 1fr;
  min-height: 100vh;
  align-items: stretch;
}

.rail {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 18px 12px;
  height: 100vh;
  background: linear-gradient(180deg, #111827, #241044);
  color: #fff;
}

.auth-mini {
  display: grid;
  gap: 6px;
  width: 100%;
  margin-top: auto;
  justify-items: center;
  color: #fff;
  text-align: center;
}

.auth-mini img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  object-fit: cover;
}

.auth-mini strong {
  max-width: 62px;
  overflow: hidden;
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-mini small {
  color: #c4b5fd;
  font-size: 0.66rem;
  font-weight: 900;
  text-transform: uppercase;
}

.auth-mini button {
  border: 0;
  border-radius: 10px;
  padding: 7px 9px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
}

body.student-mode [data-admin-only],
body.student-mode .product-admin-actions,
body.student-mode .course-folder-actions,
body.student-mode #newCourseButton,
body.student-mode #newLessonButton,
body.student-mode #heroNewLessonButton,
body.student-mode #openProductForm {
  display: none !important;
}

.brand {
  display: grid;
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  place-items: center;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  overflow: hidden;
}

.brand img {
  display: block;
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.rail-button {
  display: grid;
  width: 54px;
  min-height: 56px;
  place-items: center;
  gap: 2px;
  border: 0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  color: #dbe2ff;
  font-weight: 800;
  transition: 0.2s ease;
}

.rail-button:hover,
.rail-button.active {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  transform: translateY(-2px);
}

.rail-button small {
  font-size: 0.58rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.mobile-nav {
  display: none;
}

.view-panel {
  display: none !important;
}

.view-panel.active {
  display: block !important;
}

.workspace.view-panel.active,
.course-workspace.view-panel.active,
.printshop-workspace.view-panel.active,
.students-workspace.view-panel.active,
.chat-workspace.view-panel.active {
  display: grid !important;
}

.sidebar {
  overflow-y: auto;
  padding: 28px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.course-sidebar {
  overflow-y: auto;
  padding: 28px;
  border-right: 1px solid var(--line);
  background:
    radial-gradient(circle at top right, rgba(124, 58, 237, 0.12), transparent 34%),
    var(--surface);
}

.sidebar-header p,
.topbar p {
  margin: 0 0 6px;
  color: var(--purple);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-header h1,
.topbar h2 {
  margin: 0;
}

.sidebar-header h1 {
  max-width: 260px;
  font-size: 2rem;
  line-height: 1.04;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 28px 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8f9fd;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.panel-section {
  margin-top: 28px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-title h2 {
  margin: 0;
  font-size: 1rem;
}

.section-title a {
  color: var(--purple);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
}

.mini-action {
  border: 0;
  background: transparent;
  color: var(--purple);
  font-size: 0.85rem;
  font-weight: 800;
}

.template-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.template-card {
  min-height: 128px;
  padding: 14px;
  border: 0;
  border-radius: 20px;
  color: #fff;
  text-align: left;
  box-shadow: 0 14px 28px rgba(39, 50, 91, 0.16);
  transition: 0.2s ease;
}

.template-card:hover {
  transform: translateY(-4px) scale(1.01);
}

.template-card span {
  display: inline-block;
  margin-bottom: 44px;
  padding: 4px 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.22);
  font-size: 0.72rem;
  font-weight: 700;
}

.template-card strong {
  display: block;
  font-size: 0.96rem;
}

.template-aurora {
  background: radial-gradient(circle at 20% 20%, #00e5ff, transparent 38%), linear-gradient(135deg, #6d28d9, #ff4d97);
}

.template-sunset {
  background: radial-gradient(circle at 80% 20%, #ffe66d, transparent 34%), linear-gradient(135deg, #ff7a18, #af2dff);
}

.template-minimal {
  background: linear-gradient(135deg, #111827, #64748b);
}

.template-green {
  background: radial-gradient(circle at 70% 30%, #d9f99d, transparent 34%), linear-gradient(135deg, #059669, #0f766e);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chips button,
.text-preset,
.upload-button {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}

.chips button {
  padding: 10px 12px;
}

.text-preset {
  width: 100%;
  margin-bottom: 10px;
  padding: 14px;
  text-align: left;
}

.text-preset.subtle {
  color: var(--muted);
  font-weight: 600;
}

.upload-button {
  display: block;
  width: 100%;
  padding: 14px;
  text-align: center;
  transition: 0.2s ease;
}

.upload-button:hover {
  border-color: rgba(124, 58, 237, 0.35);
  color: var(--purple);
  transform: translateY(-2px);
}

.upload-button input {
  display: none;
}

.workspace {
  display: grid;
  grid-template-rows: 84px 1fr;
  min-width: 0;
}

.course-workspace {
  display: grid;
  grid-template-rows: 84px 1fr;
  min-width: 0;
  background: #f4f6fb;
}

.printshop-workspace {
  display: grid;
  grid-column: 2 / -1;
  grid-template-rows: auto 1fr;
  min-width: 0;
  min-height: 100vh;
  background: #fff7fb;
}

.students-workspace {
  display: grid;
  grid-column: 2 / -1;
  grid-template-rows: auto 1fr;
  min-width: 0;
  min-height: 100vh;
  background: #f4f6fb;
}

.chat-workspace {
  display: grid;
  grid-column: 2 / -1;
  grid-template-rows: auto 1fr;
  min-width: 0;
  min-height: 100vh;
  background: #f4f6fb;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px);
}

.topbar h2 {
  font-size: 1.12rem;
}

.actions {
  display: flex;
  gap: 12px;
}

.ghost-button,
.primary-button,
.toolbar button {
  border: 0;
  border-radius: 14px;
  font-weight: 800;
}

.ghost-button {
  padding: 12px 16px;
  background: #edf0f8;
  color: var(--ink);
}

.primary-button {
  padding: 12px 18px;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: #fff;
  box-shadow: 0 12px 24px rgba(124, 58, 237, 0.26);
}

.editor {
  display: grid;
  grid-template-rows: 64px 1fr;
  min-height: 0;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 28px;
  border-bottom: 1px solid var(--line);
  background: #fbfcff;
}

.toolbar button {
  padding: 10px 14px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 6px 16px rgba(24, 32, 51, 0.08);
}

.zoom {
  margin-left: auto;
  color: var(--muted);
  font-weight: 800;
}

.canvas-wrap {
  display: grid;
  overflow: auto;
  padding: 46px;
  place-items: center;
  background:
    linear-gradient(90deg, rgba(124, 58, 237, 0.06) 1px, transparent 1px),
    linear-gradient(rgba(124, 58, 237, 0.06) 1px, transparent 1px);
  background-color: #eef2fb;
  background-size: 28px 28px;
}

.canvas {
  position: relative;
  width: min(760px, 80vw);
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 34px;
  background: linear-gradient(135deg, #2b1055, #7597de);
  box-shadow: var(--shadow);
  color: #fff;
  isolation: isolate;
}

.canvas-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(0, 229, 255, 0.65), transparent 28%),
    radial-gradient(circle at 80% 30%, rgba(255, 92, 154, 0.72), transparent 30%),
    radial-gradient(circle at 50% 86%, rgba(255, 255, 255, 0.2), transparent 36%);
  z-index: -2;
  pointer-events: none;
}

.canvas::before {
  position: absolute;
  inset: 70px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 30px;
  content: "";
  pointer-events: none;
}

.floating-badge {
  position: absolute;
  top: 92px;
  left: 92px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.canvas-title {
  position: absolute;
  top: 170px;
  left: 90px;
  width: 570px;
  margin: 0;
  font-size: clamp(3.2rem, 5vw, 4.9rem);
  line-height: 0.94;
  letter-spacing: -0.06em;
}

.canvas-subtitle {
  position: absolute;
  left: 96px;
  bottom: 154px;
  width: 430px;
  margin: 0;
  color: rgba(255, 255, 255, 0.84);
  font-size: 1.15rem;
  line-height: 1.5;
}

.canvas-cta {
  position: absolute;
  left: 96px;
  bottom: 88px;
  padding: 16px 22px;
  border: 0;
  border-radius: 18px;
  background: #fff;
  color: #34135f;
  font-weight: 900;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.18);
}

.shape {
  position: absolute;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(6px);
}

.shape-one {
  right: 88px;
  bottom: 96px;
  width: 132px;
  height: 132px;
  transform: rotate(18deg);
}

.shape-two {
  right: 118px;
  top: 90px;
  width: 96px;
  height: 96px;
  border-radius: 50%;
}

.editable {
  outline: 0;
  user-select: none;
  touch-action: none;
  cursor: grab;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.editable:active {
  cursor: grabbing;
}

.editable[contenteditable="true"] {
  cursor: text;
  user-select: text;
}

.editable.selected {
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.7), 0 0 0 8px rgba(0, 196, 204, 0.65);
  transform: translateY(-2px);
}

.resize-box {
  position: absolute;
  z-index: 20;
  border: 3px solid #61f2ff;
  border-radius: 12px;
  pointer-events: none;
  box-shadow: 0 0 0 2px rgba(19, 24, 46, 0.15);
}

.resize-box.hidden {
  display: none;
}

.resize-handle {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 3px solid #61f2ff;
  border-radius: 50%;
  background: #fff;
  pointer-events: auto;
}

.resize-handle[data-handle="nw"] {
  top: -11px;
  left: -11px;
  cursor: nwse-resize;
}

.resize-handle[data-handle="ne"] {
  top: -11px;
  right: -11px;
  cursor: nesw-resize;
}

.resize-handle[data-handle="sw"] {
  bottom: -11px;
  left: -11px;
  cursor: nesw-resize;
}

.resize-handle[data-handle="se"] {
  right: -11px;
  bottom: -11px;
  cursor: nwse-resize;
}

.dynamic-shape {
  position: absolute;
  top: 48%;
  left: 62%;
  width: 116px;
  height: 116px;
  background: rgba(255, 255, 255, 0.28);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
}

.dynamic-text {
  position: absolute;
  left: 96px;
  max-width: 420px;
  color: #fff;
  line-height: 1.1;
  letter-spacing: -0.03em;
  text-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
  word-break: normal;
}

.dynamic-clone {
  width: min(360px, 55%);
  margin: 0;
  padding: 8px 10px;
  border-radius: 14px;
  font-size: 2rem;
  font-weight: 900;
}

.dynamic-button {
  position: absolute;
  padding: 14px 18px;
  border: 0;
  border-radius: 16px;
  background: #fff;
  color: #34135f;
  font-weight: 900;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.18);
}

.canvas-image {
  position: absolute;
  top: 120px;
  left: 120px;
  width: 260px;
  height: auto;
  object-fit: contain;
  border-radius: 0;
  box-shadow: none;
}

.course-list {
  display: grid;
  gap: 12px;
}

.course-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.course-item span {
  display: grid;
  width: 34px;
  height: 34px;
  grid-row: span 2;
  place-items: center;
  border-radius: 12px;
  background: #edf0ff;
  color: var(--purple);
  font-weight: 900;
  font-size: 1rem;
}

.course-item strong {
  align-self: end;
}

.course-item small {
  color: var(--muted);
  font-weight: 700;
}

.course-item.active {
  border-color: rgba(124, 58, 237, 0.4);
  box-shadow: 0 14px 32px rgba(124, 58, 237, 0.12);
}

.lessons-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin: 28px 0 16px;
}

.lessons-header h3,
.lessons-header p {
  margin: 0;
}

.lessons-header p {
  color: var(--muted);
}

.course-page {
  overflow: auto;
  padding: 34px;
}

.printshop-page {
  overflow: visible;
  padding: 34px;
}

.printshop-page > * {
  width: min(1240px, 100%);
  margin-right: auto;
  margin-left: auto;
}

.course-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  min-height: 300px;
  padding: 36px;
  border-radius: 32px;
  background:
    radial-gradient(circle at 80% 20%, rgba(0, 196, 204, 0.55), transparent 28%),
    linear-gradient(135deg, #161b3d, #7c3aed);
  color: #fff;
  box-shadow: var(--shadow);
}

.course-hero h2 {
  max-width: 680px;
  margin: 18px 0 14px;
  font-size: clamp(2.3rem, 5vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: -0.06em;
}

.course-hero p {
  max-width: 560px;
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1.08rem;
  line-height: 1.6;
}

.course-hero button {
  flex: 0 0 auto;
  padding: 16px 20px;
  border: 0;
  border-radius: 16px;
  background: #fff;
  color: #34135f;
  font-weight: 900;
}

.lesson-pill {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.course-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 24px;
}

.course-card {
  min-height: 180px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 16px 32px rgba(31, 41, 71, 0.08);
}

.course-card > span {
  font-size: 2rem;
}

.course-card h3 {
  margin: 20px 0 10px;
}

.course-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.admin-actions button {
  padding: 9px 11px;
  border: 0;
  border-radius: 12px;
  background: #edf0f8;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
}

.admin-actions button.danger {
  background: #fee2e2;
  color: #b91c1c;
}

.video-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 7px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.video-status.ready {
  background: #dcfce7;
  color: #166534;
}

.course-folder-actions {
  grid-column: 2;
  display: flex;
  gap: 8px;
}

.course-folder-actions button {
  border: 0;
  background: transparent;
  color: var(--purple);
  font-size: 0.78rem;
  font-weight: 800;
}

.course-folder-actions button.danger {
  color: #dc2626;
}

.printshop-hero {
  min-height: 300px;
  padding: 44px;
  border-radius: 32px;
  background:
    radial-gradient(circle at 88% 18%, rgba(255, 255, 255, 0.55), transparent 18%),
    radial-gradient(circle at 18% 20%, rgba(255, 92, 154, 0.45), transparent 24%),
    linear-gradient(135deg, #7c3aed, #ff5c9a 55%, #ffb86b);
  color: #fff;
  box-shadow: var(--shadow);
}

.printshop-hero h2 {
  max-width: 860px;
  margin: 18px 0 14px;
  font-size: clamp(3rem, 5vw, 5.4rem);
  line-height: 0.94;
  letter-spacing: -0.06em;
}

.printshop-hero p {
  max-width: 620px;
  margin: 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 1.08rem;
  line-height: 1.6;
}

.shop-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin: 30px auto 22px;
  padding: 20px;
  border: 1px solid #f6d7e7;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 16px 36px rgba(114, 33, 91, 0.08);
}

.shop-toolbar h3,
.shop-toolbar p {
  margin: 0;
}

.shop-heading {
  min-width: 240px;
}

.shop-heading h3 {
  font-size: 1.35rem;
}

.shop-toolbar p {
  margin-top: 6px;
  color: var(--muted);
}

.shop-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.filter-pill {
  border: 1px solid #f6d7e7;
  border-radius: 999px;
  padding: 11px 14px;
  background: #fff;
  color: #9d174d;
  font-weight: 900;
}

.filter-pill.active {
  border-color: transparent;
  background: #db2777;
  color: #fff;
  box-shadow: 0 10px 24px rgba(219, 39, 119, 0.24);
}

.shop-search {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 320px;
  padding: 12px 14px;
  border: 1px solid #f4c4dc;
  border-radius: 16px;
  background: #fff;
}

.shop-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.product-card {
  overflow: hidden;
  border: 1px solid #f6d7e7;
  border-radius: 28px;
  background: #fff;
  text-align: left;
  box-shadow: 0 18px 48px rgba(114, 33, 91, 0.12);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 24px 60px rgba(114, 33, 91, 0.18);
}

.product-thumb {
  min-height: 235px;
  padding: 22px;
  background: var(--product-bg);
  color: #fff;
}

.product-mock {
  display: grid;
  min-height: 190px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.08)),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.16) 0 8px, transparent 8px 16px);
  font-size: 2.4rem;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.product-body {
  padding: 20px;
}

.product-category {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 7px 10px;
  border-radius: 999px;
  background: #ffe4f0;
  color: #db2777;
  font-size: 0.75rem;
  font-weight: 900;
}

.product-body h3 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 1.2rem;
  line-height: 1.25;
}

.product-body p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
}

.product-price {
  color: #db2777;
  font-size: 1.18rem;
  font-weight: 900;
}

.product-footer button {
  border: 0;
  border-radius: 14px;
  padding: 10px 12px;
  background: #111827;
  color: #fff;
  font-weight: 800;
}

.product-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  padding: 28px;
  place-items: center;
  background: rgba(12, 18, 38, 0.62);
  backdrop-filter: blur(10px);
}

.product-modal.hidden {
  display: none;
}

.product-modal-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(280px, 1.1fr) minmax(280px, 0.9fr);
  width: min(980px, 96vw);
  overflow: hidden;
  border-radius: 32px;
  background: #fff;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.32);
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-size: 1.6rem;
  font-weight: 800;
}

.modal-product-image {
  min-height: 520px;
  padding: 34px;
  background: var(--product-bg);
}

.modal-product-image .product-mock {
  min-height: 452px;
  font-size: 4.2rem;
}

.modal-product-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 44px;
}

.modal-product-content span {
  width: fit-content;
  margin-bottom: 16px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #ffe4f0;
  color: #db2777;
  font-size: 0.78rem;
  font-weight: 900;
}

.modal-product-content h2 {
  margin: 0 0 18px;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 0.98;
  letter-spacing: -0.05em;
}

.modal-product-content p {
  margin: 0 0 26px;
  color: var(--muted);
  line-height: 1.7;
}

.canva-button {
  display: inline-flex;
  width: fit-content;
  padding: 15px 18px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: #fff;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 16px 34px rgba(124, 58, 237, 0.26);
}

.product-form-card {
  position: relative;
  display: grid;
  gap: 16px;
  width: min(760px, 96vw);
  max-height: 92vh;
  overflow: auto;
  padding: 34px;
  border-radius: 32px;
  background: #fff;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.32);
}

.product-form-card h2,
.product-form-card p {
  margin: 0;
}

.product-form-card h2 {
  margin-top: 12px;
  font-size: 2.2rem;
  letter-spacing: -0.05em;
}

.product-form-card p {
  margin-top: 8px;
  color: var(--muted);
}

.product-form-card label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-weight: 800;
}

.product-form-card input,
.product-form-card textarea {
  width: 100%;
  border: 1px solid #ecd5e3;
  border-radius: 14px;
  padding: 13px 14px;
  outline: 0;
  color: var(--ink);
  background: #fffafd;
  resize: vertical;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.upload-product-image {
  padding: 14px;
  border: 1px dashed #ec4899;
  border-radius: 18px;
  background: #fff1f7;
  color: #db2777;
  text-align: center;
  cursor: pointer;
}

.upload-product-image input {
  display: none;
}

.product-image-preview {
  display: grid;
  min-height: 220px;
  overflow: hidden;
  place-items: center;
  border-radius: 22px;
  background: linear-gradient(135deg, #ffe4f0, #eef2ff);
  color: var(--muted);
  font-weight: 800;
}

.product-image-preview img,
.product-real-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-admin-actions {
  display: flex;
  gap: 8px;
}

.product-admin-actions button {
  border: 0;
  border-radius: 12px;
  padding: 9px 10px;
  background: #edf0f8;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 900;
}

.product-admin-actions button.danger {
  background: #fee2e2;
  color: #b91c1c;
}

.students-page {
  padding: 32px;
}

.students-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 30px;
  border-radius: 28px;
  background:
    radial-gradient(circle at top right, rgba(0, 196, 204, 0.16), transparent 34%),
    linear-gradient(135deg, #ffffff, #f7f3ff);
  box-shadow: var(--shadow);
}

.students-hero h2 {
  margin: 14px 0 10px;
  font-size: clamp(1.8rem, 4vw, 3rem);
  letter-spacing: -0.05em;
}

.students-hero p,
.students-status {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.students-status {
  margin-top: 22px;
  font-weight: 800;
}

.students-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-top: 22px;
}

.student-search {
  display: grid;
  gap: 8px;
  width: min(100%, 420px);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
}

.student-search input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  outline: none;
  box-shadow: 0 12px 24px rgba(31, 41, 71, 0.07);
}

.student-search input:focus {
  border-color: rgba(109, 74, 255, 0.5);
  box-shadow: 0 0 0 4px rgba(109, 74, 255, 0.12);
}

.students-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin-top: 22px;
}

.student-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 14px 28px rgba(31, 41, 71, 0.08);
}

.student-avatar {
  display: grid;
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  place-items: center;
  overflow: hidden;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: #fff;
  font-weight: 900;
}

.student-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.student-info {
  min-width: 0;
  flex: 1;
}

.student-info h3 {
  margin: 0 0 6px;
  color: var(--ink);
}

.student-info p {
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.student-meta span {
  padding: 6px 9px;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--purple);
  font-size: 0.72rem;
  font-weight: 900;
}

.student-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.student-action {
  border: 0;
  border-radius: 12px;
  padding: 9px 11px;
  background: #eef2ff;
  color: var(--purple);
  font-size: 0.76rem;
  font-weight: 900;
  cursor: pointer;
}

.student-action:hover {
  transform: translateY(-1px);
}

.student-action.danger {
  background: #fff1f2;
  color: #e11d48;
}

.chat-page {
  display: grid;
  gap: 22px;
  padding: 32px;
}

.chat-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 30px;
  border-radius: 28px;
  background:
    radial-gradient(circle at top right, rgba(109, 74, 255, 0.2), transparent 34%),
    linear-gradient(135deg, #ffffff, #f7f3ff);
  box-shadow: var(--shadow);
}

.chat-hero h2 {
  margin: 14px 0 10px;
  font-size: clamp(1.8rem, 4vw, 3rem);
  letter-spacing: -0.05em;
}

.chat-hero p,
.chat-empty,
.chat-status {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.chat-card {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 18px;
  background: #fff;
  box-shadow: 0 16px 34px rgba(31, 41, 71, 0.08);
}

.chat-messages {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 360px;
  max-height: 58vh;
  overflow: auto;
  padding: 8px;
}

.chat-empty,
.chat-status {
  font-weight: 800;
}

.chat-message {
  display: flex;
  gap: 10px;
  max-width: 78%;
}

.chat-message.mine {
  justify-self: end;
  flex-direction: row-reverse;
}

.chat-avatar {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  overflow: hidden;
  border-radius: 15px;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: #fff;
  font-size: 0.8rem;
  font-weight: 900;
}

.chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-bubble {
  border-radius: 18px;
  padding: 12px 14px;
  background: #f2f5fb;
  color: var(--ink);
}

.chat-message.mine .chat-bubble {
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: #fff;
}

.chat-message-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.chat-message-header strong {
  font-size: 0.86rem;
}

.chat-message-header small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.chat-message.mine .chat-message-header small {
  color: rgba(255, 255, 255, 0.76);
}

.chat-bubble p {
  margin: 0;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.chat-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  background: #f8fafc;
  color: var(--ink);
  font: inherit;
  outline: none;
}

.chat-form input:focus {
  border-color: rgba(109, 74, 255, 0.5);
  box-shadow: 0 0 0 4px rgba(109, 74, 255, 0.12);
}

.chat-form button {
  border: 0;
  border-radius: 16px;
  padding: 0 20px;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 64px 1fr;
  }

  .sidebar {
    display: none;
  }

  .course-sidebar {
    display: none;
  }

  .workspace {
    min-height: 100vh;
  }

  .course-workspace {
    min-height: 100vh;
  }

  .printshop-workspace {
    min-height: 100vh;
  }

  .students-workspace {
    min-height: 100vh;
  }

  .chat-workspace {
    min-height: 100vh;
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (max-width: 720px) {
  .login-screen {
    min-height: 100svh;
    padding: 18px;
  }

  .login-card {
    width: 100%;
    max-width: 420px;
    justify-self: center;
    padding: 34px 28px;
  }

  .login-brand {
    width: 180px;
    height: 180px;
  }

  .login-brand img {
    width: 142px;
  }

  .app-shell {
    grid-template-columns: 1fr;
    padding-bottom: 92px;
  }

  .rail {
    display: none;
  }

  .mobile-nav {
    position: fixed;
    right: 14px;
    bottom: 14px;
    left: 14px;
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 24px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 18px 46px rgba(31, 41, 71, 0.18);
    backdrop-filter: blur(16px);
  }

  .mobile-nav-button {
    display: grid;
    min-height: 58px;
    place-items: center;
    gap: 4px;
    border: 0;
    border-radius: 18px;
    background: transparent;
    color: var(--muted);
    font-weight: 900;
  }

  .mobile-nav-button span {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 12px;
    background: #eef2ff;
    font-size: 0.95rem;
  }

  .mobile-nav-button small {
    font-size: 0.68rem;
    font-weight: 900;
  }

  .mobile-nav-button.active {
    background: linear-gradient(135deg, var(--blue), var(--purple));
    color: #fff;
    box-shadow: 0 12px 26px rgba(109, 74, 255, 0.28);
  }

  .mobile-nav-button.active span {
    background: rgba(255, 255, 255, 0.2);
  }

  body.student-mode .mobile-nav {
    grid-template-columns: repeat(4, 1fr);
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .workspace {
    grid-template-rows: auto 1fr;
  }

  .course-workspace {
    grid-template-rows: auto 1fr;
  }

  .printshop-workspace {
    grid-template-rows: auto 1fr;
  }

  .students-workspace {
    grid-template-rows: auto 1fr;
  }

  .chat-workspace {
    grid-template-rows: auto 1fr;
  }

  .canvas-wrap {
    padding: 24px;
  }

  .canvas {
    width: 92vw;
    border-radius: 24px;
  }

  .course-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .students-page {
    padding: 24px;
  }

  .students-hero,
  .chat-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .chat-page {
    padding: 24px;
  }

  .chat-message {
    max-width: 92%;
  }

  .chat-form {
    grid-template-columns: 1fr;
  }

  .chat-form button {
    min-height: 48px;
  }

  .course-grid {
    grid-template-columns: 1fr;
  }

  .shop-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .shop-controls {
    justify-content: flex-start;
  }

  .shop-search {
    width: 100%;
    min-width: 0;
  }

  .product-grid,
  .product-modal-card,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .modal-product-image {
    min-height: 320px;
  }

  .modal-product-image .product-mock {
    min-height: 260px;
    font-size: 2.8rem;
  }
}
