/* ============================================================
   Content Review — Light Theme v3
   ============================================================ */
:root {
  --bg: #f6f7fa;
  --bg-elevated: #ffffff;
  --surface: #f1f3f6;
  --surface-2: #e8ecf1;
  --border: #dde2ea;
  --border-strong: #c4cdd9;

  --text: #1a202c;
  --text-2: #4a5568;
  --muted: #718096;

  --primary: #2563eb;
  --primary-2: #1d4ed8;
  --primary-soft: #dbeafe;
  --primary-glow: rgba(37, 99, 235, 0.15);

  --success: #16a34a;
  --success-soft: #dcfce7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --purple: #7c3aed;
  --purple-soft: #ede9fe;

  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 12px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "SF Pro Display", "Sarabun", "Noto Sans Thai", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body { padding-bottom: 80px; }
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, textarea, select { font-family: inherit; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.bold { font-weight: 600; }
.right { display: flex; justify-content: flex-end; gap: 8px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ============ LOGIN ============ */
.center-screen { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card {
  max-width: 380px; text-align: center; padding: 36px 28px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.login-card .logo { font-size: 52px; margin-bottom: 8px; }
.login-card h1 { margin: 0 0 6px; font-size: 24px; color: var(--text); }
.btn-google {
  background: white; color: #1f2937; border: 1px solid var(--border);
  width: 100%; padding: 14px; margin: 20px 0 12px;
  font-weight: 600; font-size: 15px;
  border-radius: 10px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: var(--shadow-sm);
}
.btn-google:hover { background: #f9fafb; box-shadow: var(--shadow); }

/* ============ STICKY HEADER (consolidated: topbar + tabs + hero in one card) ============ */
.sticky-header {
  position: sticky; top: 0; z-index: 50;
  background: linear-gradient(135deg, var(--primary-soft), var(--purple-soft));
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  border-radius: 0 0 22px 22px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.07);
}

/* ============ TOP BAR (default — for admin.html etc) ============ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
}
/* When inside sticky-header, remove its own sticky/background (blend into purple card) */
.sticky-header .topbar {
  position: static;
  background: transparent;
  border-bottom: none;
  backdrop-filter: none;
  padding: 6px 16px 0;
  box-shadow: none;
}
.sticky-header .brand { font-size: 14.5px; }
.sticky-header .avatar { width: 28px; height: 28px; border-width: 1.5px; }
.topbar-inner {
  max-width: 960px; margin: 0 auto;
  display: flex; align-items: center; gap: 16px;
}
.brand {
  font-weight: 700; font-size: 17px;
  white-space: nowrap; flex-shrink: 0; color: var(--text);
}
.topbar-spacer { flex: 1; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  cursor: pointer; border: 2px solid var(--border);
  transition: 0.15s;
}
.avatar:hover { border-color: var(--primary); }

/* Tab pills */
.tabs-row {
  max-width: 960px; margin: 0 auto; padding: 4px 16px 2px;
  display: flex; gap: 6px; overflow-x: auto;
  scrollbar-width: none;
}
.sticky-header .tab { padding: 5px 12px; font-size: 12.5px; }
.tabs-row::-webkit-scrollbar { display: none; }
.tab {
  background: var(--bg-elevated); color: var(--text-2);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 9px 16px; cursor: pointer; white-space: nowrap;
  font-size: 14px; font-weight: 500;
  transition: 0.15s; flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.tab:hover { color: var(--text); border-color: var(--border-strong); }
.tab.active {
  background: var(--tab-color, var(--primary));
  color: white; border-color: transparent;
  box-shadow: 0 4px 12px var(--primary-glow);
}

/* ============ CONTAINER ============ */
.container {
  max-width: 960px; margin: 0 auto;
  padding: 16px 20px;
  display: flex; flex-direction: column; gap: 16px;
}

/* ============ HERO ============ */
.hero {
  background: linear-gradient(135deg, var(--primary-soft), var(--purple-soft));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}
.hero-greeting { display: flex; flex-direction: column; gap: 4px; }
.hero-greeting h1 { margin: 0; font-size: 22px; color: var(--text); }
.hero-greeting .sub { color: var(--text-2); font-size: 13px; }
.hero-stats { display: flex; gap: 12px; }
.stat {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 12px; padding: 10px 16px;
  text-align: center; min-width: 68px;
  box-shadow: var(--shadow-sm);
}
.stat .n { font-size: 24px; font-weight: 700; line-height: 1.1; }
.stat .label { font-size: 11px; color: var(--text-2); margin-top: 2px; font-weight: 500; }

/* ============ SECTION HEADERS ============ */
.section-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 8px 4px;
}
.section-head h2 { margin: 0; font-size: 17px; font-weight: 600; color: var(--text); }
.section-head a { font-size: 13px; color: var(--text-2); }
.section-head a:hover { color: var(--primary); }

/* ============ FILTER CHIPS ============ */
.filter-bar {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin: 0 -4px;
}
.chip {
  background: var(--bg-elevated); color: var(--text-2);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 7px 14px; cursor: pointer; font-size: 13px;
  transition: 0.15s; font-weight: 500;
}
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip.active {
  background: var(--text); color: white;
  border-color: var(--text);
}

/* ============ FEED CARDS ============ */
.feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.post {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: 0.15s;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.post:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}
.post-media {
  aspect-ratio: 4 / 3; background: #e8ecf1;
  position: relative; overflow: hidden;
}
.post-media img, .post-media video { width: 100%; height: 100%; object-fit: cover; }

/* === Animated thumbnail: 4 frames, 8s cycle, continuous coverage ===
   Frame visible 25% of cycle (2s) with 6% crossfades — overlapping so
   there is ALWAYS at least one frame at opacity:1 on every card. */
.post-media .frame {
  position: absolute; inset: 0;
  opacity: 0;
  animation: thumb-cycle 8s linear infinite;
}
.post-media .frame:nth-child(1) { animation-delay: 0s; }
.post-media .frame:nth-child(2) { animation-delay: -6s; }  /* same as +2s */
.post-media .frame:nth-child(3) { animation-delay: -4s; }
.post-media .frame:nth-child(4) { animation-delay: -2s; }
@keyframes thumb-cycle {
  0%   { opacity: 1; }
  25%  { opacity: 1; }
  31%  { opacity: 0; }
  94%  { opacity: 0; }
  100% { opacity: 1; }
}

.post-media .badge-overlay {
  position: absolute; top: 10px; left: 10px;
  background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(8px);
  padding: 4px 9px; border-radius: 6px;
  font-size: 11px; font-weight: 600; color: white;
  z-index: 2;
}
.post-media .status-overlay {
  position: absolute; top: 10px; right: 10px;
  padding: 4px 10px; border-radius: 6px;
  font-size: 11px; font-weight: 700;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.status-pending  { background: var(--warn);    color: white; }
.status-approved { background: var(--success); color: white; }
.status-rejected { background: var(--danger);  color: white; }

.post-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.post-author {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-2);
}
.post-author img { width: 22px; height: 22px; border-radius: 50%; }
.post-caption {
  font-size: 14px; line-height: 1.45; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.review-note {
  background: var(--warn-soft);
  border-left: 3px solid var(--warn);
  padding: 8px 10px; border-radius: 6px;
  font-size: 12.5px;
  color: #6b3410;
}
.review-note b { color: #4a2509; }

.post-actions { display: flex; gap: 6px; margin-top: 4px; }

/* ============ BUTTONS ============ */
.btn {
  background: var(--bg-elevated); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 14px; font-size: 14px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: 0.15s; font-weight: 500;
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--surface); border-color: var(--border-strong); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-2); border-color: var(--primary-2); }
.btn-success { background: var(--success); border-color: var(--success); color: white; }
.btn-success:hover { filter: brightness(0.95); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: white; }
.btn-danger:hover { filter: brightness(0.95); }
.btn-ghost { background: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--surface); }
.btn-sm { padding: 6px 10px; font-size: 12.5px; border-radius: 8px; }
.btn-icon {
  width: 36px; height: 36px; padding: 0; justify-content: center; border-radius: 50%;
}

/* ============ FAB ============ */
.fab {
  position: fixed; bottom: 88px; right: 20px; z-index: 40;
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--primary); color: white;
  border: none; cursor: pointer;
  font-size: 28px; line-height: 1;
  box-shadow: 0 8px 24px var(--primary-glow), 0 4px 12px rgba(37,99,235,0.25);
  display: flex; align-items: center; justify-content: center;
  transition: 0.2s;
}
.fab:hover { transform: scale(1.05); background: var(--primary-2); }
.fab:active { transform: scale(0.95); }

/* ============ BOTTOM NAV ============ */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 45;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  display: flex;
}
.bnav-btn {
  flex: 1; background: transparent; border: none; cursor: pointer;
  color: var(--muted); padding: 8px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 11px; transition: 0.15s; font-weight: 500;
}
.bnav-btn .icon { font-size: 22px; line-height: 1; }
.bnav-btn.active { color: var(--primary); }
.bnav-btn:hover { color: var(--text); }

/* ============ MODALS ============ */
.modal {
  border: none; padding: 0; background: transparent;
  max-width: 92vw; max-height: 92vh; margin: auto;
}
.modal::backdrop {
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(6px);
  animation: fadein 0.2s;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.modal .card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-lg);
  min-width: min(420px, 92vw);
  max-width: min(680px, 92vw);
  max-height: 92vh; overflow-y: auto;
}
.modal h3 { margin: 0 0 16px; font-size: 19px; color: var(--text); }
.modal label { display: block; margin: 10px 0; font-size: 13px; color: var(--text-2); font-weight: 500; }
.modal input, .modal select, .modal textarea {
  width: 100%; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; color: var(--text);
  margin-top: 4px; font-size: 14px;
  transition: 0.15s;
}
.modal input:focus, .modal select:focus, .modal textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.modal textarea { min-height: 80px; resize: vertical; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ============ COMPOSER MODAL ============ */
.composer-modal .card { width: 560px; }
.composer-slot-banner {
  background: linear-gradient(135deg, var(--primary-soft), var(--purple-soft));
  border: 1px solid var(--primary);
  color: var(--primary);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px; font-weight: 600;
  margin: 0 0 12px;
  text-align: center;
}
.dropzone {
  display: block; border: 2px dashed var(--border);
  border-radius: var(--radius); padding: 36px 20px; text-align: center;
  cursor: pointer; transition: 0.15s; margin-top: 4px;
  background: var(--surface);
}
.dropzone:hover, .dropzone.drag {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.dz-icon { font-size: 38px; margin-bottom: 8px; }
.dz-inner > div:nth-child(2) { color: var(--text); }
.dz-hint { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

.preview {
  margin-top: 14px; border-radius: var(--radius); overflow: hidden;
  max-height: 320px; background: #e8ecf1; position: relative;
}
.preview img, .preview video { width: 100%; max-height: 320px; object-fit: contain; }
.preview .change-file {
  position: absolute; top: 8px; right: 8px;
  background: rgba(15, 23, 42, 0.75); color: white;
  border: none; border-radius: 999px; padding: 6px 12px;
  font-size: 12px; cursor: pointer;
}

.char-counter {
  font-size: 12px; color: var(--muted);
  text-align: right; margin-top: 4px;
}
.char-counter.warn { color: var(--warn); }

/* ============ EMPTY STATES ============ */
.empty {
  text-align: center; padding: 48px 20px;
  color: var(--muted);
}
.empty .emoji { font-size: 56px; margin-bottom: 12px; opacity: 0.7; }
.empty .title { font-size: 16px; color: var(--text); margin-bottom: 4px; font-weight: 600; }
.empty .hint { font-size: 13px; max-width: 320px; margin: 0 auto; color: var(--text-2); }

/* ============ ADMIN — tab rows with toggle ============ */
.tab-row {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
  transition: 0.15s;
}
.tab-row-paused {
  background: var(--surface);
  opacity: 0.7;
  border-style: dashed;
}
.tab-row-paused .tab-row-main input { background: transparent; }
.tab-row-main {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.tab-row-main input {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px; color: var(--text); font-size: 13.5px;
}
.tab-row-controls {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding-top: 8px; border-top: 1px dashed var(--border);
}

.toggle-switch {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer; user-select: none; font-size: 13px; font-weight: 600;
}
.toggle-switch input { display: none; }
.toggle-switch .slider {
  width: 40px; height: 22px;
  background: var(--muted); border-radius: 999px;
  position: relative; transition: 0.2s;
}
.toggle-switch .slider::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; background: white; border-radius: 50%;
  transition: 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .slider { background: var(--success); }
.toggle-switch input:checked + .slider::after { left: 20px; }

.tab-startdate-label, .tab-lead-label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--text-2);
}
.tab-startdate, .tab-lead {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 8px; padding: 5px 8px; color: var(--text); font-size: 13px;
}
.tab-lead { min-width: 160px; }
.future-badge {
  background: var(--warn-soft); color: var(--warn);
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}

/* ============ ADMIN ============ */
.admin-table { width: 100%; border-collapse: collapse; background: var(--bg-elevated); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.admin-table th, .admin-table td {
  padding: 12px 14px; text-align: left;
  border-bottom: 1px solid var(--border); font-size: 14px;
}
.admin-table th {
  background: var(--surface);
  color: var(--text-2); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.5px;
  font-weight: 600;
}
.admin-table input, .admin-table select {
  background: var(--bg-elevated); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 8px; font-size: 13px;
}
.tab-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.tab-check {
  /* Default = NO access = RED */
  background: var(--danger);
  border: 1px solid var(--danger);
  color: white;
  padding: 6px 10px; border-radius: 8px; cursor: pointer; font-size: 12px;
  user-select: none; transition: 0.15s; font-weight: 500;
}
.tab-check:hover { filter: brightness(1.1); }
/* Employee = green */
.tab-check.on {
  background: var(--success);
  border-color: var(--success);
  color: white;
}
/* Reviewer = darker green */
.tab-check.on.reviewer {
  background: #15803d;
  border-color: #15803d;
  color: white;
}

/* ============ TOAST ============ */
.toast {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: white;
  padding: 10px 18px; border-radius: 999px;
  font-size: 13px; font-weight: 500;
  z-index: 100; box-shadow: var(--shadow-lg);
  animation: toast-in 0.25s, toast-out 0.25s 2.5s forwards;
}
@keyframes toast-in { from { transform: translate(-50%, 20px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes toast-out { to { transform: translate(-50%, 20px); opacity: 0; } }

/* ============ WEEK SCHEDULE — blends into sticky-header gradient ============ */
.week-hero {
  padding: 0 12px 8px;
}
.week-hero-inner {
  max-width: 928px; margin: 0 auto;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 2px 4px 0;
  box-shadow: none;
  display: flex; flex-direction: column; gap: 5px;
}
.week-hero .hero-top { gap: 8px; }
.week-hero .hero-greeting h2 { font-size: 13.5px; line-height: 1.15; font-weight: 700; }
.week-hero .hero-greeting .sub { display: none; }       /* hide rอบ sub-line to save room */
.week-hero .success-circle { padding: 2px 9px; }
.week-hero .success-circle .sc-pct { font-size: 15px; }
.week-hero .success-circle .sc-label { font-size: 8.5px; margin-top: 0; }
.week-hero .success-bar { height: 5px; }
.week-hero .wstat { padding: 3px 4px; border-radius: 6px; }
.week-hero .wstat .n { font-size: 13.5px; line-height: 1.05; }
.week-hero .wstat .lbl { font-size: 9.5px; margin-top: 1px; }
.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.hero-greeting h2 { margin: 0; font-size: 17px; color: var(--text); }
.success-circle {
  text-align: center;
  background: rgba(255, 255, 255, 0.75);
  border-radius: 12px;
  padding: 6px 14px;
  border: 1px solid rgba(255,255,255,0.9);
}
.success-circle .sc-pct {
  font-size: 22px; font-weight: 800; line-height: 1;
  color: var(--success); letter-spacing: -0.5px;
}
.success-circle .sc-pct.low  { color: var(--danger); }
.success-circle .sc-pct.mid  { color: var(--warn); }
.success-circle .sc-pct.high { color: var(--success); }
.success-circle .sc-label {
  font-size: 10px; font-weight: 600; color: var(--text-2);
  margin-top: 2px; text-transform: uppercase; letter-spacing: 0.5px;
}
.success-bar {
  width: 100%; height: 8px;
  background: rgba(255,255,255,0.6);
  border-radius: 999px; overflow: hidden;
  border: 1px solid rgba(255,255,255,0.5);
}
.success-bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--success), #22c55e);
  border-radius: 999px;
  transition: width 0.6s ease;
}
.success-bar-fill.low  { background: linear-gradient(90deg, var(--danger), #ef4444); }
.success-bar-fill.mid  { background: linear-gradient(90deg, var(--warn), #f59e0b); }
.week-nav {
  display: flex; align-items: center; gap: 10px;
}
.week-range {
  flex: 1; text-align: center; font-weight: 700; font-size: 16px; color: var(--text);
}
.week-nav .btn-icon { width: 36px; height: 36px; font-size: 18px; }

.week-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
}
.wstat {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  padding: 6px 4px; text-align: center;
}
.wstat .n { font-size: 17px; font-weight: 700; line-height: 1.1; }
.wstat .lbl { font-size: 10.5px; color: var(--text-2); margin-top: 2px; font-weight: 500; }
.wstat.ok   .n { color: var(--success); }
.wstat.pend .n { color: var(--warn); }
.wstat.bad  .n { color: var(--danger); }
.wstat.tot  .n { color: var(--primary); }

.schedule {
  display: flex; flex-direction: column; gap: 12px;
}
.day-row {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px; align-items: center;
  box-shadow: var(--shadow-sm);
  transition: 0.15s;
}
.day-row.today {
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--bg-elevated) 70%, var(--primary-soft));
  box-shadow: 0 4px 12px var(--primary-glow);
}
.day-row.past { opacity: 0.7; }

.day-label { display: flex; flex-direction: column; gap: 2px; }
.day-label .day-name { font-weight: 600; font-size: 14px; color: var(--text); }
.day-label .day-date { font-size: 12.5px; color: var(--text-2); }
.day-label .day-tag {
  margin-top: 4px;
  display: inline-block; align-self: flex-start;
  background: var(--primary); color: white;
  font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px;
  letter-spacing: 0.5px;
}

.day-slots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.clip-col {
  display: flex; flex-direction: column; gap: 8px;
}
.slot-comment {
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12.5px;
  line-height: 1.4;
  cursor: pointer;
  transition: 0.15s;
  border: 1px solid var(--border);
}
.slot-comment:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.slot-comment .cmt-header {
  display: flex; align-items: center; gap: 6px;
  font-weight: 700; font-size: 11.5px;
  margin-bottom: 4px;
}
.slot-comment .cmt-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  font-size: 11px; color: white; line-height: 1;
}
.slot-comment .cmt-body { color: var(--text); }
.slot-comment .cmt-empty { color: var(--muted); font-style: italic; }

.comment-approved {
  background: var(--success-soft);
  border-color: rgba(22,163,74,0.25);
}
.comment-approved .cmt-icon { background: var(--success); }
.comment-approved .cmt-status { color: var(--success); }

.comment-rejected {
  background: var(--danger-soft);
  border-color: rgba(220,38,38,0.25);
}
.comment-rejected .cmt-icon { background: var(--danger); }
.comment-rejected .cmt-status { color: var(--danger); }

.comment-pending {
  background: var(--warn-soft);
  border-color: rgba(217,119,6,0.25);
}
.comment-pending .cmt-icon { background: var(--warn); }
.comment-pending .cmt-status { color: var(--warn); }
.slot {
  position: relative;
  aspect-ratio: 4 / 5;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  overflow: hidden;
  transition: 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.slot:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.slot.empty {
  border-style: dashed;
  background: var(--surface);
  color: var(--muted);
}
.slot.empty:hover { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.slot.empty.drop-hover {
  border-color: var(--primary); background: var(--primary-soft);
  border-style: solid; transform: scale(1.02);
  box-shadow: 0 0 0 4px var(--primary-glow);
}
.slot.uploading {
  border-style: solid; border-color: var(--primary);
  background: var(--primary-soft);
  cursor: wait;
}
.upload-spinner {
  text-align: center; font-size: 28px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.upload-spinner span { font-size: 11px; }
.slot.empty .slot-plus { font-size: 36px; font-weight: 300; line-height: 1; }
.slot.filled { border-color: var(--border-strong); }
.slot.filled.status-approved { border-color: var(--success); }
.slot.filled.status-rejected { border-color: var(--danger); }
.slot.filled.status-pending  { border-color: var(--warn); }

.slot-media { position: absolute; inset: 0; background: #000; }
.slot-media img, .slot-media video { width: 100%; height: 100%; object-fit: cover; }

.slot-label {
  position: absolute; bottom: 6px; left: 6px;
  background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(4px);
  color: white; font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 6px;
  z-index: 2;
}
.slot.empty .slot-label {
  position: static; background: transparent; color: var(--muted);
  font-weight: 500; padding: 0; margin-top: 6px;
}

.slot-pill {
  position: absolute; top: 8px; right: 8px;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px; font-weight: 700;
  color: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  z-index: 2;
  backdrop-filter: blur(4px);
}
.slot-pill .pill-icon { font-size: 13px; line-height: 1; }
.slot-pill .pill-comment {
  margin-left: 2px;
  background: rgba(255,255,255,0.3);
  border-radius: 999px;
  padding: 0 4px;
  font-size: 10px;
  line-height: 1.4;
}
.pill-pending  { background: var(--warn); }
.pill-approved { background: var(--success); }
.pill-rejected { background: var(--danger); }

.load-older, .load-newer {
  display: block; width: fit-content; margin: 0 auto;
  background: var(--bg-elevated); color: var(--text-2);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.load-older:hover, .load-newer:hover {
  color: var(--primary); border-color: var(--primary);
}
.jump-today {
  position: fixed; bottom: 156px; right: 20px; z-index: 38;
  background: var(--text); color: white;
  border: none; border-radius: 999px;
  padding: 10px 16px; font-size: 13px; font-weight: 600;
  cursor: pointer; box-shadow: var(--shadow-lg);
  animation: jt-in 0.2s;
}
.jump-today:hover { transform: translateY(-2px); }
@keyframes jt-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.status-row { margin: 10px 0 0; }
.status-chip-big {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
  color: white;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 640px) {
  .container { padding: 12px 14px; }
  .topbar { padding: 10px 14px; }
  .tabs-row { padding: 10px 14px 4px; }
  .fab { bottom: 84px; right: 14px; }

  .week-stats { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .wstat { padding: 6px 4px; }
  .wstat .n { font-size: 18px; }

  .day-row { grid-template-columns: 1fr; padding: 10px; gap: 10px; }
  .day-label { flex-direction: row; align-items: center; gap: 8px; }
  .day-label .day-tag { margin-top: 0; }
  .slot { aspect-ratio: 3 / 4; }
}

/* ============ METADATA SECTIONS (Upload Form) ============ */
.meta-section {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  background: var(--surface-2, #fafbfc);
}
.meta-section > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  padding: 4px 0;
  user-select: none;
  outline: none;
}
.meta-section[open] > summary { margin-bottom: 8px; }
.meta-section label { display: block; margin-top: 10px; }
.meta-section label > span {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--text, #1f2937);
}
.meta-section em.required {
  color: #dc2626; font-style: normal; font-size: 12px; margin-left: 4px;
}
.meta-section em.optional {
  color: #6b7280; font-style: normal; font-size: 11px; margin-left: 4px; font-weight: 400;
}

/* Chip selector for editing tools */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 11px;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 999px;
  background: white;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.chip:hover { border-color: var(--primary, #3b82f6); }
.chip input[type="checkbox"] { margin: 0; cursor: pointer; }
.chip:has(input:checked) {
  background: var(--primary, #3b82f6);
  border-color: var(--primary, #3b82f6);
  color: white;
}

/* ============ REVIEW RUBRIC ============ */
.review-modal .card { max-width: 560px; }
.rubric { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.rubric-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background: var(--surface-2, #fafbfc);
}
.rubric-row .label-block { display: flex; flex-direction: column; }
.rubric-row .label-block .dim-title {
  font-weight: 600; font-size: 14px;
}
.rubric-row .label-block .dim-weight {
  font-size: 11px; color: #6b7280; font-weight: 400;
}
.rubric-row .stars { display: flex; gap: 2px; }
.rubric-row .stars input { display: none; }
.rubric-row .stars label {
  cursor: pointer;
  font-size: 24px;
  color: #d1d5db;
  transition: color 0.1s;
  line-height: 1;
}
.rubric-row .stars label:hover,
.rubric-row .stars label:hover ~ label,
.rubric-row .stars input:checked ~ label {
  color: #fbbf24;
}
/* CSS gymnastics: star group uses reversed direction so :hover propagates left */
.rubric-row .stars {
  display: inline-flex;
  flex-direction: row-reverse;
}
.rubric-total {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--primary, #3b82f6);
  padding: 10px;
  background: var(--surface-2, #fafbfc);
  border-radius: 8px;
}
.btn-warning {
  background: #f59e0b; color: white; border-color: #f59e0b;
}
.btn-warning:hover { background: #d97706; }

/* ============ LEARN SYSTEM ============ */
.learn-container { padding-bottom: 90px; }
.learn-hero {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff; border-radius: 16px; padding: 18px; margin: 14px 0;
}
.learn-hero-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.learn-hero h2 { margin: 0 0 2px; font-size: 19px; }
.learn-hero .muted { color: rgba(255,255,255,.8) !important; }
.learn-ring {
  flex-shrink: 0; width: 70px; height: 70px; border-radius: 50%;
  background: rgba(255,255,255,.15); display: flex; flex-direction: column;
  align-items: center; justify-content: center; border: 3px solid rgba(255,255,255,.5);
}
.learn-ring .lr-pct { font-size: 20px; font-weight: 800; }
.learn-ring .lr-label { font-size: 10px; opacity: .85; }
.learn-bar { height: 8px; background: rgba(255,255,255,.25); border-radius: 99px; margin: 14px 0 12px; overflow: hidden; }
.learn-bar-fill { height: 100%; background: #fbbf24; border-radius: 99px; transition: width .4s; }
.learn-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.lstat { background: rgba(255,255,255,.12); border-radius: 10px; padding: 8px; text-align: center; }
.lstat .n { font-size: 18px; font-weight: 800; }
.lstat .l { font-size: 11px; opacity: .85; }
.learn-unlock { margin-top: 12px; background: rgba(255,255,255,.18); border-radius: 10px; padding: 10px; font-weight: 600; text-align: center; }

.phase-card { background: var(--surface, #fff); border: 1px solid var(--border, #e5e7eb); border-radius: 14px; padding: 16px; margin-bottom: 14px; }
.phase-card.locked { opacity: .65; }
.phase-card.completed { border-color: #10b981; }
.phase-head { display: flex; align-items: center; gap: 12px; }
.phase-emoji { font-size: 30px; }
.phase-titles { flex: 1; }
.phase-title { font-weight: 700; font-size: 16px; }
.phase-done { font-size: 11px; color: #10b981; background: #d1fae5; padding: 1px 8px; border-radius: 99px; margin-left: 6px; }
.phase-lock { font-size: 22px; }
.phase-locked-note { margin-top: 10px; }
.lessons-list { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.lesson-row {
  display: flex; align-items: center; gap: 10px; text-align: left;
  background: var(--surface-2, #fafbfc); border: 1px solid var(--border, #eee);
  border-radius: 10px; padding: 10px 12px; cursor: pointer; width: 100%;
  transition: background .15s, border-color .15s;
}
.lesson-row:hover:not(.locked) { border-color: var(--primary, #4f46e5); background: #fff; }
.lesson-row.locked { cursor: not-allowed; opacity: .6; }
.lr-icon { font-size: 18px; flex-shrink: 0; }
.lr-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.lr-title { font-weight: 600; font-size: 14px; }
.lr-sub { display: block; margin-top: 1px; }
.lr-score { font-weight: 700; color: #10b981; font-size: 13px; }
.assign-section { margin-top: 14px; border-top: 1px dashed var(--border, #e5e7eb); padding-top: 12px; }
.assign-head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 14px; margin-bottom: 8px; flex-wrap: wrap; gap: 6px; }
.assign-btn { width: 100%; }
.assign-badge { font-size: 12px; padding: 2px 10px; border-radius: 99px; font-weight: 600; }
.assign-badge.grading { background: #fef3c7; color: #92400e; }
.assign-badge.pass { background: #d1fae5; color: #065f46; }
.assign-badge.fail { background: #fee2e2; color: #991b1b; }
.assign-badge.err { background: #f3f4f6; color: #6b7280; }

/* Modals */
.lesson-modal .card, .quiz-modal .card, .assign-modal .card { max-width: 640px; width: 92vw; max-height: 86vh; overflow-y: auto; }
.modal-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; position: sticky; top: 0; background: var(--surface, #fff); padding-bottom: 8px; z-index: 2; }
.tool-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tool-chip { font-size: 12px; background: #eef2ff; color: #4338ca; padding: 3px 10px; border-radius: 99px; }
.lesson-content { line-height: 1.65; font-size: 15px; }
.lesson-content .md-h1 { font-size: 20px; margin: 16px 0 8px; }
.lesson-content .md-h2 { font-size: 17px; margin: 16px 0 6px; }
.lesson-content .md-h3 { font-size: 15px; margin: 12px 0 4px; font-weight: 700; }
.lesson-content p { margin: 8px 0; }
.lesson-content .md-ul, .lesson-content .md-ol { margin: 8px 0; padding-left: 22px; }
.lesson-content li { margin: 3px 0; }
.lesson-content code { background: #f3f4f6; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.lesson-content .md-pre { background: #1e293b; color: #e2e8f0; padding: 12px; border-radius: 8px; overflow-x: auto; font-size: 13px; margin: 10px 0; }
.lesson-content .md-pre code { background: none; color: inherit; padding: 0; }
.lesson-content .md-quote { border-left: 3px solid var(--primary, #4f46e5); padding: 4px 12px; margin: 10px 0; color: #475569; background: #f8fafc; }
.lesson-content .md-table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 13px; }
.lesson-content .md-table th, .lesson-content .md-table td { border: 1px solid var(--border, #e5e7eb); padding: 6px 8px; text-align: left; }
.lesson-content .md-table th { background: #f3f4f6; font-weight: 700; }

/* Quiz */
.quiz-list { display: flex; flex-direction: column; gap: 16px; }
.quiz-q { padding: 12px; border: 1px solid var(--border, #e5e7eb); border-radius: 10px; }
.quiz-question { font-weight: 600; margin-bottom: 8px; line-height: 1.4; }
.quiz-choices { display: flex; flex-direction: column; gap: 6px; }
.quiz-choice { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border, #e5e7eb); border-radius: 8px; cursor: pointer; }
.quiz-choice:has(input:checked) { border-color: var(--primary, #4f46e5); background: #eef2ff; }
.quiz-result-score { font-size: 28px; font-weight: 800; text-align: center; margin: 10px 0; }
.quiz-result-score.pass { color: #10b981; }
.quiz-result-score.fail { color: #ef4444; }
.quiz-review { display: flex; flex-direction: column; gap: 12px; }
.quiz-rev-q { padding: 10px; border-radius: 8px; border: 1px solid var(--border, #e5e7eb); }
.quiz-rev-q.ok { background: #f0fdf4; border-color: #bbf7d0; }
.quiz-rev-q.no { background: #fef2f2; border-color: #fecaca; }
.quiz-rev-choice { padding: 4px 8px; font-size: 13px; border-radius: 6px; }
.quiz-rev-choice.correct { background: #d1fae5; font-weight: 600; }
.quiz-rev-choice.wrong { background: #fee2e2; text-decoration: line-through; }
.quiz-explain { margin-top: 6px; }

/* Assignment */
.assign-brief { margin-bottom: 14px; border: 1px solid var(--border, #e5e7eb); border-radius: 10px; padding: 12px; background: var(--surface-2, #fafbfc); }
.assign-brief > summary { cursor: pointer; font-weight: 700; }
.assign-criteria { margin-top: 10px; font-size: 13px; padding: 10px; background: #fffbeb; border-radius: 8px; line-height: 1.5; }
.assign-form h4 { margin: 4px 0 10px; }
.assign-form label { display: block; margin-bottom: 12px; }
.assign-form label > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.assign-form textarea { width: 100%; resize: vertical; }
.ai-grading { text-align: center; padding: 24px; font-weight: 600; color: #92400e; background: #fef3c7; border-radius: 10px; }
.ai-fb { padding: 14px; border-radius: 12px; margin-bottom: 14px; }
.ai-fb.pass { background: #f0fdf4; border: 1px solid #86efac; }
.ai-fb.fail { background: #fef2f2; border: 1px solid #fca5a5; }
.ai-fb.err { background: #f3f4f6; padding: 12px; border-radius: 10px; }
.ai-fb-head { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.ai-fb-summary { margin-bottom: 10px; line-height: 1.5; }
.ai-dims { display: flex; flex-direction: column; gap: 8px; }
.ai-dim { background: rgba(255,255,255,.6); border-radius: 8px; padding: 8px 10px; }
.ai-dim-top { display: flex; justify-content: space-between; font-weight: 600; font-size: 13px; }
.ai-dim-score { color: var(--primary, #4f46e5); }
.ai-dim-bar { height: 6px; background: #e5e7eb; border-radius: 99px; margin: 5px 0; overflow: hidden; }
.ai-dim-bar > div { height: 100%; background: var(--primary, #4f46e5); border-radius: 99px; }
.ai-list { margin-top: 10px; }
.ai-list-h { font-weight: 700; font-size: 13px; margin-bottom: 3px; }
.ai-list ul { margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.5; }

.phase-hidden-note {
  text-align: center; padding: 16px; margin-top: 4px;
  color: #6b7280; font-size: 13px; font-weight: 500;
  background: var(--surface-2, #fafbfc); border: 1px dashed var(--border, #e5e7eb);
  border-radius: 12px;
}

/* Lesson sub-point outline */
.lesson-outline {
  background: #eef2ff; border: 1px solid #c7d2fe; border-radius: 10px;
  padding: 12px 14px; margin-bottom: 14px;
}
.lesson-outline .lo-head { font-weight: 700; font-size: 13.5px; margin-bottom: 6px; color: #4338ca; }
.lesson-outline ol { margin: 0; padding-left: 20px; font-size: 13.5px; line-height: 1.7; }
.lesson-outline li { color: #1e293b; }

/* Checkpoint stepper */
.cp-progress { height: 6px; background: #e5e7eb; border-radius: 99px; overflow: hidden; margin-bottom: 14px; }
.cp-progress-fill { height: 100%; background: var(--primary, #4f46e5); border-radius: 99px; transition: width .3s; }
.cp-point {
  display: inline-block; font-size: 12.5px; font-weight: 600; color: #4338ca;
  background: #eef2ff; padding: 3px 12px; border-radius: 99px; margin-bottom: 10px;
}
.cp-q { font-size: 16px; margin-bottom: 12px; line-height: 1.45; }
.quiz-choice.cp-correct { border-color: #10b981; background: #d1fae5; }
.quiz-choice.cp-wrong { border-color: #ef4444; background: #fee2e2; }
.cp-fb { margin-top: 12px; padding: 12px; border-radius: 10px; }
.cp-fb.ok { background: #f0fdf4; border: 1px solid #86efac; }
.cp-fb.no { background: #fef2f2; border: 1px solid #fca5a5; }
.cp-fb-head { font-weight: 700; margin-bottom: 4px; }
.cp-fb-exp { font-size: 13.5px; line-height: 1.5; }
.cp-summary { text-align: center; margin-top: 6px; }

.variant-badge {
  background: #f5f3ff; border: 1px solid #ddd6fe; color: #6d28d9;
  border-radius: 10px; padding: 8px 12px; font-size: 13px; font-weight: 600;
  margin-bottom: 12px;
}

/* Senior confirm queue (admin) */
.senior-queue { background: #fffbeb; border: 1px solid #fde68a; border-radius: 14px; padding: 14px; margin-bottom: 16px; }
.sq-head { font-weight: 700; font-size: 14px; margin-bottom: 10px; color: #92400e; }
.sq-item { background: #fff; border: 1px solid var(--border, #e5e7eb); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.sq-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.sq-score { font-weight: 700; font-size: 13px; padding: 2px 10px; border-radius: 99px; }
.sq-score.g { background: #d1fae5; color: #065f46; }
.sq-score.o { background: #ffedd5; color: #9a3412; }
.sq-check { background: #f5f3ff; border-radius: 8px; padding: 8px 10px; margin: 8px 0; }
.sq-check ul { margin: 4px 0 0; padding-left: 20px; font-size: 13px; }
.sq-writeup { margin: 8px 0; }
.sq-writeup > summary { cursor: pointer; font-size: 13px; font-weight: 600; }
.sq-note { width: 100%; margin-top: 8px; resize: vertical; }

.assign-badge.review { background: #fef3c7; color: #92400e; }
.ai-fb.review { background: #fffbeb; border: 1px solid #fde68a; }
.ai-list.human { background: #f5f3ff; border-radius: 8px; padding: 8px 10px; margin-top: 10px; }

/* Email whitelist (admin) + login error */
.allow-box { background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; }
.allow-box > summary { cursor: pointer; font-weight: 700; font-size: 14px; color: #075985; }
.allow-add { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.allow-add input { flex: 1; min-width: 140px; }
.allow-list { display: flex; flex-direction: column; gap: 6px; }
.allow-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--border, #e5e7eb); border-radius: 8px; padding: 8px 10px; }
.login-error { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; border-radius: 10px; padding: 10px 12px; font-size: 13px; margin: 12px 0; line-height: 1.5; }

/* Review: optional stars + history */
.rubric-optional { margin: 10px 0; border: 1px solid var(--border, #e5e7eb); border-radius: 10px; padding: 10px 12px; background: var(--surface-2, #fafbfc); }
.rubric-optional > summary { cursor: pointer; font-weight: 600; font-size: 13.5px; color: #6b7280; }
.rubric-optional[open] > summary { margin-bottom: 8px; }

.review-history { margin-top: 14px; }
.rh-head { font-weight: 700; font-size: 13.5px; margin-bottom: 8px; }
.rh-item { border-left: 3px solid var(--border, #e5e7eb); padding: 6px 0 6px 12px; margin-bottom: 10px; }
.rh-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rh-verdict { font-weight: 700; font-size: 13px; }
.rh-verdict.v-approve { color: #10b981; }
.rh-verdict.v-revise { color: #f59e0b; }
.rh-verdict.v-reject { color: #ef4444; }
.rh-score { font-size: 12px; background: #eef2ff; color: #4338ca; padding: 1px 8px; border-radius: 99px; font-weight: 600; }
.rh-comment { margin-top: 4px; font-size: 13.5px; line-height: 1.5; }

/* ============ TRAINING GROUND ============ */
.tg-hero { background: linear-gradient(135deg,#dc2626,#ea580c); color:#fff; border-radius:16px; padding:18px; margin:14px 0; }
.tg-hero-top { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.tg-hero h2 { margin:0 0 2px; font-size:19px; }
.tg-hero .muted { color:rgba(255,255,255,.85)!important; }
.tg-streak { text-align:center; background:rgba(255,255,255,.15); border-radius:12px; padding:8px 14px; }
.tg-streak-n { font-size:22px; font-weight:800; }
.tg-streak-l { font-size:11px; opacity:.85; }
.tg-stats { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin-top:14px; }
.tg-stats .lstat { background:rgba(255,255,255,.12); border-radius:10px; padding:8px; text-align:center; }
.tg-stats .n { font-size:18px; font-weight:800; } .tg-stats .l { font-size:11px; opacity:.85; }

.tg-form { padding-bottom:90px; }
.tg-section { background:var(--surface,#fff); border:1px solid var(--border,#e5e7eb); border-radius:12px; padding:14px; margin-bottom:14px; }
.tg-section h3 { margin:0 0 4px; font-size:15px; }
.tg-row { border:1px solid var(--border,#eee); border-radius:10px; padding:10px; margin-top:10px; background:var(--surface-2,#fafbfc); }
.tg-row-h { font-weight:700; font-size:13px; margin-bottom:6px; color:#4b5563; }
.tg-row input { width:100%; margin-bottom:6px; }
.tg-shot { display:flex; align-items:center; gap:10px; margin-bottom:6px; flex-wrap:wrap; }
.tg-shot-prev { width:60px; height:60px; object-fit:cover; border-radius:8px; border:1px solid var(--border,#ddd); }
.tg-file input { display:block; margin-top:4px; }

.tg-result { background:var(--surface,#fff); border:1px solid var(--border,#e5e7eb); border-radius:12px; padding:16px; margin-bottom:14px; }
.tg-result-head { display:flex; justify-content:space-between; align-items:center; gap:8px; margin-bottom:8px; }
.tg-senior { padding:8px 12px; border-radius:8px; font-weight:600; font-size:13.5px; margin-bottom:10px; }
.tg-senior.good { background:#d1fae5; color:#065f46; } .tg-senior.redo { background:#fef3c7; color:#92400e; }
.tg-fb-summary { background:#eff6ff; border-radius:8px; padding:10px; margin-bottom:10px; line-height:1.5; }
.tg-flags { background:#fef2f2; border:1px solid #fecaca; color:#991b1b; border-radius:8px; padding:8px 10px; font-size:13px; margin-bottom:10px; }
.tg-fb-block { margin:12px 0; } .tg-fb-block h4 { margin:0 0 6px; font-size:14px; }
.tg-pain-item { border-left:3px solid var(--border,#e5e7eb); padding:6px 0 6px 10px; margin-bottom:8px; }
.tg-pain-top { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.depth { font-size:11px; font-weight:700; padding:1px 8px; border-radius:99px; }
.depth.d-ลึก { background:#d1fae5; color:#065f46; }
.depth.d-กลาง { background:#fef3c7; color:#92400e; }
.depth.d-ตื้น { background:#fee2e2; color:#991b1b; }
.depth.d-flag { background:#fee2e2; color:#991b1b; }

.tg-hist { margin-top:14px; } .tg-hist > summary { cursor:pointer; font-weight:600; }
.tg-hist-row { display:grid; grid-template-columns:1fr 1fr auto; gap:8px; padding:8px; border-bottom:1px solid var(--border,#eee); font-size:13px; }

.tg-admin-box { background:#eff6ff; border:1px solid #bfdbfe; border-radius:12px; padding:12px; margin-bottom:16px; }
.tg-admin-box > summary { cursor:pointer; font-weight:700; color:#1e40af; }
.tg-roster { display:flex; flex-direction:column; gap:5px; margin:10px 0; }
.tg-roster-row { display:flex; justify-content:space-between; gap:8px; padding:8px 10px; border-radius:8px; background:#fff; }
.tg-roster-row.miss { background:#fef2f2; }
.tg-admin-subs { display:flex; flex-direction:column; gap:10px; margin-top:10px; }
.ts-item { background:#fff; border:1px solid var(--border,#e5e7eb); border-radius:10px; padding:10px; }
.ts-top { font-weight:600; font-size:13.5px; }
.ts-detail { margin:8px 0; } .ts-detail > summary { cursor:pointer; font-size:13px; }
.ts-pain { padding:4px 0; font-size:13px; border-bottom:1px solid #f3f4f6; }
.ts-note { width:100%; margin:8px 0; resize:vertical; }

/* Training verdict + hint */
.tg-verdict { text-align:center; font-size:18px; font-weight:800; padding:12px; border-radius:12px; margin-bottom:12px; }
.tg-verdict.pass { background:#d1fae5; color:#065f46; }
.tg-verdict.fail { background:#fee2e2; color:#991b1b; }
.tg-verdict-sub { font-size:12.5px; font-weight:500; margin-top:4px; }
.tg-pain-item.ok { background:#f0fdf4; border-left-color:#86efac; border-radius:6px; }
.tg-pain-item.no { background:#fef2f2; border-left-color:#fca5a5; border-radius:6px; }
.pain-mark { flex-shrink:0; }
.tg-hint { margin-top:6px; font-size:13px; line-height:1.5; background:#fffbeb; border:1px dashed #fcd34d; border-radius:8px; padding:7px 10px; color:#78350f; }

/* Training per-task cards */
.tg-task { background:var(--surface,#fff); border:1px solid var(--border,#e5e7eb); border-radius:12px; padding:14px; margin-bottom:14px; }
.tg-task-head { display:flex; justify-content:space-between; align-items:center; gap:8px; margin-bottom:4px; }
.tg-task-head h3 { margin:0; font-size:15px; }
.tg-tbadge { font-size:12px; font-weight:700; padding:3px 10px; border-radius:99px; white-space:nowrap; }
.tg-tbadge.pass { background:#d1fae5; color:#065f46; }
.tg-tbadge.fail { background:#fee2e2; color:#991b1b; }
.tg-tbadge.grading { background:#fef3c7; color:#92400e; }
.tg-tbadge.err { background:#f3f4f6; color:#6b7280; }
.tg-tbadge.none { background:#f3f4f6; color:#9ca3af; }

/* Training per-item graded rows */
.tg-row.ok { background:#f0fdf4; border-color:#86efac; }
.tg-row.no { background:#fef2f2; border-color:#fca5a5; }
.tg-row .tg-row-h { display:flex; align-items:center; gap:6px; }
.clip-sum { font-size:13.5px; margin:4px 0; line-height:1.4; }

/* Pain example (reference) card */
.pain-example { background:#f0f9ff; border:1px dashed #7dd3fc; border-radius:10px; padding:10px 12px; margin-bottom:12px; }
.pain-ex-head { font-weight:700; font-size:13px; color:#0369a1; margin-bottom:6px; }
.pain-ex-row { font-size:13px; line-height:1.5; margin-bottom:3px; }
.pain-ex-note { margin-top:6px; }

/* Admin detail — full item view */
.adm-item { border:1px solid var(--border,#e5e7eb); border-radius:8px; padding:8px 10px; margin-bottom:8px; background:#fff; }
.adm-item.ok { background:#f0fdf4; border-color:#bbf7d0; }
.adm-item.no { background:#fef2f2; border-color:#fecaca; }
.adm-head { font-size:13.5px; font-weight:600; margin-bottom:4px; display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.adm-head a { font-weight:500; }
.adm-field { font-size:13px; line-height:1.5; margin:2px 0; }

/* Paste-a-screenshot zone */
.paste-zone { border:1.5px dashed #93c5fd; background:#eff6ff; color:#1d4ed8; border-radius:8px; padding:10px; text-align:center; font-size:13px; cursor:pointer; margin-bottom:6px; outline:none; user-select:none; }
.paste-zone:focus { border-color:#2563eb; background:#dbeafe; box-shadow:0 0 0 3px rgba(37,99,235,.15); }
.paste-zone.done { border-style:solid; border-color:#10b981; background:#d1fae5; color:#065f46; }

/* Admin day navigation */
.tg-daynav { display:flex; align-items:center; gap:8px; margin:10px 0; flex-wrap:wrap; }
.tg-daynav input[type="date"] { padding:5px 8px; border:1px solid var(--border,#d1d5db); border-radius:8px; font-size:13px; }

/* Thinking framework box */
.think-box { background:#fefce8; border:1px solid #fde047; border-radius:12px; padding:12px 14px; margin-bottom:14px; }
.think-box > summary { cursor:pointer; font-weight:700; font-size:14px; color:#854d0e; }
.think-steps { margin:10px 0 6px; padding-left:22px; font-size:13.5px; line-height:1.7; }
.think-steps li { margin-bottom:4px; }
