:root {
  color-scheme: light;
  --bg: #f2f4f1;
  --surface: #ffffff;
  --surface-soft: #f7f8f6;
  --ink: #18201c;
  --muted: #69736d;
  --line: #d8ded9;
  --green-950: #143c31;
  --green-800: #205b48;
  --green-700: #28705a;
  --green-100: #e4efe9;
  --red: #b94732;
  --red-soft: #f7e6e1;
  --amber: #9a6a18;
  --amber-soft: #faf0d8;
  --blue: #315f7a;
  --blue-soft: #e4edf2;
  --shadow: 0 8px 28px rgba(24, 45, 36, 0.07);
  --radius: 8px;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--bg); font-size: 14px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid rgba(40, 112, 90, 0.22);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  grid-template-rows: 70px minmax(0, 1fr);
}

.topbar {
  grid-column: 1 / -1;
  position: sticky;
  top: 0;
  z-index: 30;
  height: 70px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto minmax(360px, 1fr);
  align-items: center;
  gap: 22px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand { appearance: none; display: flex; align-items: center; gap: 11px; width: fit-content; padding: 0; border: 0; color: var(--ink); background: transparent; text-align: left; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; color: #fff; background: var(--red); border-radius: 6px; font-size: 20px; font-weight: 800; }
.brand-copy strong, .brand-copy small { display: block; letter-spacing: 0; }
.brand-copy strong { font-size: 16px; }
.brand-copy small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.topbar-center { justify-self: center; }
.project-chip, .model-badge { display: inline-flex; align-items: center; gap: 7px; }
.project-chip { padding: 7px 10px; color: var(--green-800); background: var(--green-100); border-radius: 5px; font-size: 12px; font-weight: 600; }
.status-dot, .model-dot { width: 7px; height: 7px; border-radius: 50%; background: #329166; }
.topbar-tools { justify-self: end; display: flex; align-items: center; gap: 12px; }
.user-summary { text-align: right; }
.user-summary strong, .user-summary small { display: block; }
.user-summary strong { font-size: 13px; }
.user-summary small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.model-badge { min-height: 34px; padding: 6px 10px; color: var(--amber); background: var(--amber-soft); border: 1px solid #ead8ad; border-radius: 5px; font-size: 12px; }
.model-badge.is-ready { color: var(--green-800); background: var(--green-100); border-color: #c8dfd2; }
.model-badge.is-ready .model-dot { background: #329166; }
.model-badge:not(.is-ready) .model-dot { background: #bf811d; }
.role-switch { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; background: #edf0ed; border-radius: 6px; }
.role-button { min-width: 68px; padding: 7px 10px; color: var(--muted); background: transparent; border: 0; border-radius: 4px; }
.role-button.is-active { color: #fff; background: var(--green-950); }

.sidebar { position: sticky; top: 70px; height: calc(100vh - 70px); padding: 18px 13px; color: #dfeae5; background: var(--green-950); overflow-y: auto; }
#main-nav { display: grid; gap: 4px; }
.nav-section { margin: 16px 11px 6px; color: #91aa9f; font-size: 11px; }
.project-nav-title { margin-top: 22px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.12); color: #cfe5da; line-height: 1.4; }
.nav-button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; padding: 9px 11px; color: #cbdad3; background: transparent; border: 0; border-radius: 5px; text-align: left; }
.nav-button:hover { color: #fff; background: rgba(255,255,255,0.07); }
.nav-button.is-active { color: #fff; background: #2b6754; }
.nav-button.nav-level-3 { padding-left: 24px; font-size: 13px; }
.nav-button.nav-level-3 .icon { width: 16px; height: 16px; }
.nav-button .nav-count { margin-left: auto; min-width: 22px; padding: 2px 6px; color: #cfe5da; background: rgba(255,255,255,0.1); border-radius: 10px; font-size: 11px; text-align: center; }
.icon { width: 18px; height: 18px; flex: 0 0 auto; stroke-width: 1.8; }
.button-icon { width: 16px; height: 16px; }
.sidebar-evidence { margin: 24px 10px 0; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.14); }
.sidebar-evidence span, .sidebar-evidence strong, .sidebar-evidence small { display: block; }
.sidebar-evidence span, .sidebar-evidence small { color: #94ada2; font-size: 11px; line-height: 1.5; }
.sidebar-evidence strong { margin: 5px 0; color: #fff; }

.main-content { min-width: 0; padding: 26px clamp(18px, 3.2vw, 48px) 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-head h1 { margin: 0; font-size: 26px; line-height: 1.25; letter-spacing: 0; }
.page-head p { max-width: 760px; margin: 6px 0 0; color: var(--muted); line-height: 1.65; }
.page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.eyebrow { display: block; margin-bottom: 6px; color: var(--green-700); font-size: 12px; font-weight: 700; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 8px 13px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 5px; text-decoration: none; white-space: nowrap; }
.button:hover { border-color: #93a198; }
.button.primary { color: #fff; background: var(--green-700); border-color: var(--green-700); }
.button.danger { color: #fff; background: var(--red); border-color: var(--red); }
.button.subtle { color: var(--green-800); background: var(--green-100); border-color: transparent; }
.button.small { min-height: 31px; padding: 5px 9px; font-size: 12px; }
.button.icon-only { width: 38px; padding: 0; }
.button:disabled { cursor: not-allowed; opacity: 0.48; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat { min-width: 0; padding: 17px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.stat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12px; }
.stat-value { margin-top: 8px; font-size: 27px; font-weight: 750; font-variant-numeric: tabular-nums; }
.stat-meta { margin-top: 4px; color: var(--muted); font-size: 11px; }
.stat .icon { color: var(--green-700); }

.layout-two { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.8fr); gap: 18px; align-items: start; }
.layout-even { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.panel { min-width: 0; margin-bottom: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.panel-header h2, .panel-header h3 { margin: 0; font-size: 16px; letter-spacing: 0; }
.panel-header p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.panel-body { padding: 18px; }
.panel-body.flush { padding: 0; }
.section-title { margin: 0 0 12px; font-size: 15px; }

.loop-track { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; margin-bottom: 24px; }
.loop-step { position: relative; min-width: 0; padding: 15px 13px; border-right: 1px solid var(--line); }
.loop-step:last-child { border-right: 0; }
.loop-step small { display: block; color: var(--muted); font-size: 10px; }
.loop-step strong { display: block; margin-top: 5px; font-size: 13px; line-height: 1.4; }
.loop-step.is-current { color: #fff; background: var(--green-700); }
.loop-step.is-current small { color: #d9eee5; }

.task-list { display: grid; }
.task-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 13px 0; border-bottom: 1px solid #e7ebe8; }
.task-row:last-child { border-bottom: 0; }
.task-index { display: grid; place-items: center; width: 34px; height: 34px; color: var(--green-800); background: var(--green-100); border-radius: 50%; font-weight: 700; }
.task-row strong, .task-row small { display: block; }
.task-row small { margin-top: 3px; color: var(--muted); }

.badge { display: inline-flex; align-items: center; gap: 5px; width: fit-content; padding: 4px 7px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.badge.green { color: var(--green-800); background: var(--green-100); }
.badge.amber { color: var(--amber); background: var(--amber-soft); }
.badge.red { color: var(--red); background: var(--red-soft); }
.badge.blue { color: var(--blue); background: var(--blue-soft); }
.badge.gray { color: #57615c; background: #ecefec; }
.source-callout { padding: 13px 14px; color: #33443c; background: #f6f8f6; border-left: 3px solid var(--green-700); line-height: 1.6; }
.warning-callout { padding: 13px 14px; color: #65480d; background: var(--amber-soft); border-left: 3px solid #c08b2a; line-height: 1.6; }
.danger-callout { padding: 13px 14px; color: #713225; background: var(--red-soft); border-left: 3px solid var(--red); line-height: 1.6; }

.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; }
.fact dt { color: var(--muted); font-size: 11px; }
.fact dd { margin: 4px 0 0; font-weight: 600; line-height: 1.5; }
.clean-list { margin: 0; padding-left: 18px; }
.clean-list li { margin: 7px 0; line-height: 1.55; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 5px 8px; color: #48534d; background: #eef1ee; border-radius: 4px; font-size: 11px; }

.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.data-table th { padding: 10px 12px; color: var(--muted); background: var(--surface-soft); border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 650; text-align: left; white-space: nowrap; }
.data-table td { padding: 12px; border-bottom: 1px solid #e6eae7; vertical-align: middle; line-height: 1.45; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tbody tr:hover { background: #fafbfa; }
.table-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-bottom: 16px; }
.field { display: grid; gap: 6px; }
.field label { color: #4d5852; font-size: 12px; font-weight: 650; }
.field input, .field select, .field textarea, .toolbar select, .toolbar input { width: 100%; min-height: 39px; padding: 8px 10px; color: var(--ink); background: #fff; border: 1px solid #cfd6d1; border-radius: 5px; }
.field textarea { min-height: 90px; resize: vertical; line-height: 1.6; }
.field small { color: var(--muted); line-height: 1.5; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field.full { grid-column: 1 / -1; }

.script-preview { max-height: 430px; overflow: auto; padding: 16px; color: #303a35; background: #f8f9f7; border: 1px solid var(--line); border-radius: 5px; white-space: pre-wrap; line-height: 1.75; }
.empty-state { display: grid; place-items: center; min-height: 220px; padding: 32px; color: var(--muted); text-align: center; }
.empty-state .icon { width: 34px; height: 34px; margin-bottom: 10px; color: #8da096; }
.score-ring { display: grid; place-items: center; width: 94px; height: 94px; margin: 0 auto; border: 8px solid var(--green-100); border-top-color: var(--green-700); border-radius: 50%; }
.score-ring strong { font-size: 27px; }
.score-ring small { color: var(--muted); font-size: 10px; }
.risk-list { display: grid; gap: 8px; }
.risk-item { padding: 11px 12px; background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--red); border-radius: 4px; }
.risk-item.medium { border-left-color: #c08b2a; }
.risk-item strong { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.risk-item p { margin: 6px 0 0; color: #4b5650; line-height: 1.55; }
.risk-item small { display: block; margin-top: 5px; color: var(--muted); }

.live-studio { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(290px, 0.65fr); min-height: 620px; background: #181c1a; border-radius: var(--radius); overflow: hidden; }
.live-stage { position: relative; min-height: 620px; display: grid; align-content: end; padding: 26px; color: #fff; background: linear-gradient(180deg, rgba(16,25,21,0.12), rgba(11,18,15,0.82)), url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="100" height="100"%3E%3Crect width="100" height="100" fill="%23385041"/%3E%3Cpath d="M0 70L25 48L50 65L78 35L100 53V100H0Z" fill="%232b4537"/%3E%3C/svg%3E'); background-size: cover; }
.live-top { position: absolute; top: 18px; left: 18px; right: 18px; display: flex; justify-content: space-between; align-items: center; }
.live-label { display: inline-flex; align-items: center; gap: 7px; padding: 6px 9px; color: #fff; background: var(--red); border-radius: 4px; font-size: 12px; font-weight: 700; }
.live-clock { padding: 6px 9px; background: rgba(0,0,0,0.42); border-radius: 4px; font-variant-numeric: tabular-nums; }
.product-board { max-width: 520px; padding: 18px; background: rgba(10,18,14,0.78); border: 1px solid rgba(255,255,255,0.2); border-radius: 6px; backdrop-filter: blur(6px); }
.product-board h2 { margin: 0 0 8px; font-size: 24px; }
.product-board p { margin: 4px 0; color: #dce7e1; }
.product-price { margin-top: 13px; font-size: 25px; font-weight: 800; color: #ffd27a; }
.chat-panel { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; background: #f8f9f7; }
.chat-head { padding: 15px 16px; border-bottom: 1px solid var(--line); }
.chat-head strong, .chat-head small { display: block; }
.chat-head small { margin-top: 3px; color: var(--muted); }
.chat-stream { min-height: 0; padding: 14px; overflow-y: auto; }
.chat-message { margin-bottom: 11px; padding: 10px 11px; background: #fff; border: 1px solid var(--line); border-radius: 5px; line-height: 1.55; }
.chat-message.viewer { border-left: 3px solid var(--blue); }
.chat-message.student { margin-left: 22px; border-left: 3px solid var(--green-700); }
.chat-message.feedback { background: var(--amber-soft); border-color: #ead8ad; }
.chat-message small { display: block; margin-bottom: 4px; color: var(--muted); }
.chat-controls { padding: 14px; border-top: 1px solid var(--line); }
.chat-controls textarea { width: 100%; min-height: 82px; padding: 10px; border: 1px solid #cbd3ce; border-radius: 5px; resize: vertical; }
.chat-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 9px; }

.metric-bar { display: grid; grid-template-columns: 100px minmax(0, 1fr) 62px; align-items: center; gap: 10px; margin: 10px 0; }
.bar-track { height: 8px; background: #e9edea; border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--green-700); border-radius: 4px; }
.metric-bar strong { text-align: right; font-variant-numeric: tabular-nums; }
.report-result { display: grid; gap: 14px; }
.task-box { padding: 15px; background: var(--green-100); border: 1px solid #c9ddd2; border-radius: 6px; }
.task-box h3 { margin: 0 0 8px; font-size: 16px; }

.source-list { display: grid; gap: 8px; }
.source-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px 130px 120px; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 5px; }
.source-row strong, .source-row small { display: block; }
.source-row small { margin-top: 4px; color: var(--muted); }
.conflict { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.conflict:last-child { border-bottom: 0; }
.conflict p { margin: 2px 0; line-height: 1.55; }

.video-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.video-item { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #111; }
.video-item video { display: block; width: 100%; aspect-ratio: 16/9; object-fit: contain; background: #0d0f0e; }
.video-meta { padding: 10px 11px; color: #fff; background: #242925; }
.video-meta strong, .video-meta small { display: block; overflow-wrap: anywhere; }
.video-meta small { margin-top: 4px; color: #b7c0ba; }

.timeline { display: grid; gap: 8px; }
.timeline-row { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.timeline-row:last-child { border-bottom: 0; }
.timeline-row time { color: var(--muted); font-size: 11px; }
.timeline-row strong, .timeline-row small { display: block; }
.timeline-row small { margin-top: 3px; color: var(--muted); line-height: 1.5; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(10,17,13,0.58); }
.modal { width: min(680px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: #fff; border-radius: 8px; box-shadow: 0 24px 70px rgba(0,0,0,0.24); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-body { padding: 18px; }
.toast { position: fixed; z-index: 120; right: 22px; bottom: 22px; max-width: 420px; padding: 12px 15px; color: #fff; background: #25342d; border-radius: 5px; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: 160ms ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast.is-error { background: #8c3828; }
.loading-state { min-height: 60vh; display: grid; place-items: center; align-content: center; color: var(--muted); }
.loader { width: 28px; height: 28px; border: 3px solid #d5ddd8; border-top-color: var(--green-700); border-radius: 50%; animation: spin 800ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Login */
.is-login { overflow: hidden; }
.is-login .app-shell { display: block; min-height: 100vh; }
.is-login .topbar, .is-login .sidebar { display: none; }
.is-login .main-content { padding: 0; min-height: 100vh; }
.login-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(420px, 0.65fr); background: #fff; }
.login-visual { position: relative; min-height: 100vh; display: flex; flex-direction: column; justify-content: space-between; padding: 34px 42px 52px; color: #fff; background: linear-gradient(180deg, rgba(8,66,134,0.14), rgba(5,37,78,0.44)), url("assets/login-live-commerce-no-dot.jpeg") center/cover no-repeat; }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand .brand-mark.large { width: 44px; height: 44px; font-size: 23px; }
.login-brand strong, .login-brand small { display: block; }
.login-brand strong { font-size: 18px; }
.login-brand small { margin-top: 3px; color: #dce9e2; }
.login-visual-copy { max-width: 700px; }
.login-visual-copy > span { display: inline-block; padding: 6px 9px; color: #153c30; background: rgba(255,255,255,0.88); border-radius: 4px; font-size: 12px; font-weight: 700; }
.login-visual-copy h1 { margin: 18px 0 12px; max-width: 680px; font-size: clamp(34px, 4.2vw, 58px); line-height: 1.16; letter-spacing: 0; }
.login-form-panel { display: grid; place-items: center; padding: 36px clamp(26px, 5vw, 72px); }
.login-form-wrap { width: min(420px, 100%); }
.login-form-wrap h2 { margin: 0 0 22px; font-size: 29px; }
.login-role-switch { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; margin-bottom: 20px; background: #edf0ed; border-radius: 6px; }
.login-role { min-height: 40px; color: var(--muted); background: transparent; border: 0; border-radius: 4px; }
.login-role.is-active { color: #fff; background: var(--green-950); }
.login-form-wrap form { display: grid; gap: 14px; }
.login-submit { margin-top: 4px; width: 100%; min-height: 44px; }
.demo-accounts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.demo-accounts > div { min-width: 0; padding: 11px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 6px; }
.demo-accounts span, .demo-accounts strong, .demo-accounts small { display: block; }
.demo-accounts span { color: var(--muted); font-size: 11px; }
.demo-accounts strong { margin-top: 6px; overflow-wrap: anywhere; }
.demo-accounts small { margin: 2px 0 9px; color: var(--green-700); overflow-wrap: anywhere; }

/* Student dashboard */
.project-selector-band, .progress-section, .enterprise-band, .task-acquire-band { margin-bottom: 20px; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.project-selector-band { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 0.72fr); align-items: center; gap: 30px; }
.project-selector-band h2, .section-band-head h2, .task-acquire-band h2 { margin: 0; font-size: 19px; }
.project-selector-band select, .compact-select { min-height: 40px; padding: 8px 10px; color: var(--ink); background: #fff; border: 1px solid #cbd3ce; border-radius: 5px; }
.compact-select { min-width: 250px; }
.section-band-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.progress-section > .button { margin-top: 16px; }
.loop-track.five { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 0; box-shadow: none; }
.loop-step > span { display: block; margin-top: 8px; color: var(--muted); font-size: 11px; }
.loop-step.is-complete { color: #fff; background: var(--green-700); }
.loop-step.is-complete small, .loop-step.is-complete > span { color: #d9eee5; }
.facts.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.facts .wide { grid-column: 1 / -1; }
.task-acquire-band { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.task-acquire-band p { margin: 6px 0 0; color: var(--muted); }
.task-reveal { margin-top: -6px; }

.product-showcase { margin-bottom: 20px; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.product-gallery { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.product-card { min-width: 0; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.product-card img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; background: #15231b; }
.product-card > div { padding: 11px 12px 13px; }
.product-card span { color: var(--green-700); font-size: 11px; font-weight: 700; }
.product-card h3 { margin: 5px 0 4px; font-size: 14px; }
.product-card p { min-height: 34px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.product-card strong { display: block; margin-top: 9px; color: var(--red); font-size: 15px; }
.product-catalog { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.product-detail { min-width: 0; padding: 14px; background: #fbfcfb; border: 1px solid var(--line); border-radius: 6px; }
.product-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.product-detail-head span { color: var(--green-700); font-size: 11px; font-weight: 700; }
.product-detail-head h3 { margin: 4px 0 0; font-size: 15px; }
.product-detail-head > strong { color: var(--red); font-size: 17px; white-space: nowrap; }
.product-spec { margin: 7px 0 11px; color: var(--muted); font-size: 12px; }
.product-detail dl { display: grid; gap: 8px; margin: 13px 0 0; }
.product-detail dl > div { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 8px; }
.product-detail dt { color: var(--muted); font-size: 11px; }
.product-detail dd { margin: 0; color: #44514a; font-size: 11px; line-height: 1.5; }

.enterprise-detail { margin-bottom: 20px; }
.enterprise-facts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.enterprise-copy { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.enterprise-copy section { padding: 14px; background: #f6f8f6; border-left: 3px solid var(--green-700); }
.enterprise-copy h3 { margin: 0 0 7px; font-size: 14px; }
.enterprise-copy p { margin: 0; color: #46534c; font-size: 13px; line-height: 1.65; }
.qualification-row { display: grid; gap: 10px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.qualification-row > strong { font-size: 13px; }

/* Script diagnosis */
.script-workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); gap: 16px; margin-bottom: 18px; }
.script-editor-pane, .diagnosis-pane { min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.upload-drop { position: relative; }
.upload-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-drop label { display: grid; place-items: center; min-height: 122px; padding: 18px; color: var(--green-800); background: #f3f7f4; border: 1px dashed #9db7a9; border-radius: 6px; text-align: center; cursor: pointer; }
.upload-drop label .icon { width: 26px; height: 26px; margin-bottom: 7px; }
.upload-drop label strong, .upload-drop label small { display: block; }
.upload-drop label small { margin-top: 4px; color: var(--muted); }
.upload-drop.compact label { min-height: 86px; }
.large-editor { min-height: 330px !important; }
.final-submit-zone { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; padding: 15px 18px; background: #f6f8f6; border-top: 1px solid var(--line); }
.final-submit-zone > div { flex: 1 1 200px; }
.final-submit-zone strong, .final-submit-zone small { display: block; }
.final-submit-zone small { margin-top: 3px; color: var(--muted); }
.diagnosis-empty { min-height: 560px; }
.diagnosis-report { display: grid; gap: 18px; }
.diagnosis-score { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 14px 16px; color: #fff; background: var(--green-950); border-radius: 6px; }
.diagnosis-score > div { display: flex; align-items: baseline; }
.diagnosis-score strong { font-size: 42px; }
.diagnosis-score small { margin-left: 3px; color: #cfe0d7; }
.diagnosis-score > span { max-width: 230px; color: #dce9e2; text-align: right; }
.diagnosis-dimensions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.diagnosis-dimensions > div { padding: 11px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 5px; }
.diagnosis-dimensions span, .diagnosis-dimensions strong { display: block; }
.diagnosis-dimensions span { color: var(--muted); font-size: 11px; }
.diagnosis-dimensions strong { margin-top: 4px; font-size: 20px; }
.diagnosis-report h3 { margin: 0 0 9px; font-size: 15px; }
.evidence-line { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }

/* Camera live */
.live-camera-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.55fr); height: 650px; overflow: hidden; background: #f7f8f6; border: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.camera-stage { position: relative; min-height: 0; overflow: hidden; background: #1d3026; }
.camera-background { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(7,20,14,0.06), rgba(7,20,14,0.32)), url("assets/live-background.jpeg") center/cover no-repeat; }
.camera-stage video, .camera-cutout { position: absolute; left: 50%; bottom: 0; width: min(64%, 580px); height: 82%; object-fit: cover; transform: translateX(-50%); border-bottom: 0; border-radius: 48% 48% 0 0 / 18% 18% 0 0; }
.camera-stage video { pointer-events: none; }
.camera-cutout { display: none; background: transparent; }
.camera-stage.is-segmented #camera-preview { opacity: 0; }
.camera-stage.is-segmented .camera-cutout { display: block; }
.camera-overlay { position: absolute; inset: 18px; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.camera-overlay > div:first-child { display: flex; justify-content: space-between; align-items: center; }
.live-label.is-recording { background: var(--red); }
.live-product-card { align-self: flex-start; max-width: 500px; padding: 13px 15px; color: #fff; background: rgba(9,23,16,0.78); border: 1px solid rgba(255,255,255,0.24); border-radius: 6px; backdrop-filter: blur(6px); }
.live-product-card strong, .live-product-card span { display: block; }
.live-product-card span { margin-top: 5px; color: #dbe7e0; }
.auto-comments-panel { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; min-height: 0; overflow: hidden; background: #f7f8f6; }
.auto-comments { min-height: 0; padding: 14px; overflow-y: auto; overscroll-behavior: contain; }
.auto-comment { margin-bottom: 9px; padding: 10px 11px; background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--blue); border-radius: 5px; }
.auto-comment.comment { border-left-color: var(--green-700); }
.auto-comment.request { border-left-color: #b47a20; }
.auto-comment small { color: var(--muted); }
.auto-comment p { margin: 4px 0 0; line-height: 1.5; }
.oral-response-note { display: flex; gap: 10px; align-items: center; padding: 13px 15px; color: #33463d; background: var(--green-100); border-top: 1px solid #c9ddd2; }
.oral-response-note strong, .oral-response-note small { display: block; }
.oral-response-note small { margin-top: 3px; color: var(--muted); }
.live-control-band { display: grid; grid-template-columns: minmax(260px, 0.7fr) minmax(240px, 1fr) auto; align-items: end; gap: 18px; padding: 16px 18px; background: #fff; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); }
.camera-status { align-self: center; display: flex; align-items: center; gap: 8px; }
.live-control-actions { display: flex; gap: 8px; }

/* Teacher operations */
.teacher-setup-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.import-feedback { display: grid; gap: 4px; margin-top: 14px; padding: 11px 12px; color: #235744; background: var(--green-100); border-left: 3px solid var(--green-700); line-height: 1.5; }
.import-feedback small { color: #456358; }
.import-feedback.has-errors { color: #713225; background: var(--red-soft); border-left-color: var(--red); }
.import-feedback.has-errors small { color: #7c4a3d; }
.project-admin-list { display: grid; gap: 14px; }
.project-admin-row { padding: 16px; border: 1px solid var(--line); border-radius: 6px; }
.project-admin-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.project-admin-head strong, .project-admin-head small { display: block; }
.project-admin-head small { margin-top: 4px; color: var(--muted); }
.progress-cell { display: grid; grid-template-columns: minmax(90px, 1fr) 40px; align-items: center; gap: 7px; }
.advice-cell { min-width: 210px; max-width: 330px; color: #45524b; font-size: 12px; }
.modal.wide { width: min(1060px, 100%); }
.review-split { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr); gap: 20px; }
.recording-player { display: block; width: 100%; max-height: 520px; background: #101311; border-radius: 6px; }
.score-triplet { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.score-triplet > div { padding: 12px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 5px; }
.score-triplet span, .score-triplet strong { display: block; }
.score-triplet span { color: var(--muted); font-size: 11px; }
.score-triplet strong { margin-top: 5px; font-size: 23px; }
.score-triplet .final { color: #fff; background: var(--green-700); border-color: var(--green-700); }
.score-triplet .final span { color: #d9eee5; }
.feedback-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.feedback-grid section { padding: 13px; background: var(--surface-soft); border-left: 3px solid var(--green-700); }
.feedback-grid h3 { margin: 0 0 7px; font-size: 14px; }
.feedback-grid p { margin: 0; line-height: 1.65; }

@media (max-width: 1180px) {
  .topbar { grid-template-columns: minmax(240px, 1fr) auto; }
  .topbar-center { display: none; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .loop-track { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .loop-step:nth-child(3) { border-right: 0; }
  .loop-step:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .video-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-screen { grid-template-columns: minmax(0, 1fr) 420px; }
  .script-workspace { grid-template-columns: 1fr; }
  .diagnosis-empty { min-height: 260px; }
  .live-camera-layout { grid-template-columns: minmax(0, 1fr) 330px; }
  .product-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-catalog { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .enterprise-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .teacher-setup-grid { grid-template-columns: 1fr; }
}

@media (max-width: 840px) {
  .app-shell { display: block; padding-bottom: 66px; }
  .topbar { position: sticky; display: flex; justify-content: space-between; height: 62px; padding: 0 13px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-copy small, .model-badge, .role-switch { display: none; }
  .user-summary { display: none; }
  .sidebar { position: fixed; top: auto; bottom: 0; left: 0; right: 0; z-index: 50; height: 66px; padding: 6px 7px; overflow: hidden; }
  #main-nav { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(72px, 1fr); gap: 3px; overflow-x: auto; }
  .nav-section, .sidebar-evidence, .nav-button[data-role-only="teacher"], .nav-button[data-mobile-hidden="true"] { display: none; }
  .nav-button { min-width: 0; height: 54px; flex-direction: column; justify-content: center; gap: 3px; padding: 4px 2px; font-size: 10px; }
  .nav-button .icon { width: 17px; height: 17px; }
  .nav-button .nav-count { display: none; }
  .main-content { padding: 20px 14px 42px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .page-head h1 { font-size: 22px; }
  .page-actions { width: 100%; justify-content: flex-start; }
  .layout-two, .layout-even, .live-studio { grid-template-columns: 1fr; }
  .live-studio { min-height: 0; }
  .live-stage { min-height: 460px; }
  .chat-panel { min-height: 520px; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr; }
  .source-row { grid-template-columns: 1fr auto; }
  .source-row > :nth-child(2) { display: none; }
  .video-grid { grid-template-columns: 1fr; }
  .login-screen { display: block; min-height: 100vh; }
  .login-visual { min-height: 260px; padding: 22px 20px 28px; }
  .login-visual-copy h1 { margin: 42px 0 8px; font-size: 30px; }
  .login-form-panel { padding: 28px 20px 40px; }
  .project-selector-band { grid-template-columns: 1fr; gap: 14px; }
  .task-acquire-band { align-items: flex-start; flex-direction: column; }
  .facts.four { grid-template-columns: 1fr; }
  .enterprise-facts { grid-template-columns: 1fr; }
  .enterprise-copy { grid-template-columns: 1fr; }
  .loop-track.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .loop-track.five .loop-step:nth-child(2n) { border-right: 0; }
  .loop-track.five .loop-step:nth-child(-n+4) { border-bottom: 1px solid var(--line); }
  .loop-track.five .loop-step:last-child { grid-column: 1 / -1; }
  .script-workspace { grid-template-columns: 1fr; }
  .final-submit-zone { align-items: stretch; flex-direction: column; }
  .live-camera-layout { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .camera-stage { min-height: 480px; }
  .camera-stage video, .camera-cutout { width: 82%; height: 74%; }
  .auto-comments-panel { height: 520px; }
  .live-control-band { grid-template-columns: 1fr; align-items: stretch; }
  .live-control-actions { flex-wrap: wrap; }
  .review-split { grid-template-columns: 1fr; }
  .feedback-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat { padding: 13px; }
  .stat-value { font-size: 22px; }
  .loop-track { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .loop-step:nth-child(2n) { border-right: 0; }
  .loop-step:nth-child(3) { border-right: 1px solid var(--line); }
  .loop-step:nth-child(-n+4) { border-bottom: 1px solid var(--line); }
  .button { white-space: normal; }
  .task-row { grid-template-columns: 38px minmax(0, 1fr); }
  .task-row > .badge, .task-row > .button { grid-column: 2; justify-self: start; }
  .conflict { grid-template-columns: 1fr; }
  .demo-accounts { grid-template-columns: 1fr; }
  .login-visual { min-height: 230px; }
  .login-visual-copy h1 { margin-top: 28px; font-size: 25px; }
  .compact-select { width: 100%; min-width: 0; }
  .product-gallery { grid-template-columns: 1fr 1fr; gap: 8px; }
  .product-catalog { grid-template-columns: 1fr; }
  .diagnosis-dimensions, .score-triplet { grid-template-columns: 1fr; }
  .camera-stage { min-height: 420px; }
  .camera-stage video, .camera-cutout { width: 90%; height: 70%; }
}
