/* ============================================================
   ScuolaApps Cloud — Portal Stylesheet
   A warm, playful, tablet-friendly educational theme
   ============================================================ */

/* --- Custom Properties --- */
:root {
  --color-primary: #4A90D9;
  --color-primary-dark: #3A78BF;
  --color-primary-light: #6AAAE8;
  --color-secondary: #7BC67E;
  --color-secondary-dark: #5DAF60;
  --color-accent: #F5A623;
  --color-accent-light: #FFBD4F;
  --color-bg: #FFF8F0;
  --color-bg-card: #FFFFFF;
  --color-text: #2D3436;
  --color-text-muted: #636E72;
  --color-danger: #E74C3C;
  --color-danger-light: #FADBD8;
  --color-dark: #2D3436;
  --color-dark-lighter: #3D4E50;
  --color-admin-purple: #8e44ad;
  --color-admin-purple-dark: #732d91;
  --color-admin-blue: #1e40af;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-card-hover: 0 8px 24px rgba(0, 0, 0, 0.14);
  --shadow-overlay: 0 4px 20px rgba(0, 0, 0, 0.25);
  --font-stack: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.2s ease;
  --transition-slow: 0.3s ease;
  --min-touch: 44px;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-stack);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* --- Header --- */
.header {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.student-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app-header-logo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

.student-avatar {
  font-size: 2rem;
  line-height: 1;
}

.student-name {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.date-display {
  font-size: 0.95rem;
  opacity: 0.9;
}

.mode-btn {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  padding: 0.5rem 1.2rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  min-height: var(--min-touch);
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.mode-btn:hover {
  background: rgba(255, 255, 255, 0.35);
  border-color: rgba(255, 255, 255, 0.7);
}

.mode-btn.active-tutor {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-dark);
}

/* --- Section Titles --- */
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  padding: 1.5rem 2rem 0.5rem;
  color: var(--color-text);
}

/* --- Dashboard Grid --- */
.dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.5rem;
  padding: 1rem 2rem 2rem;
}

/* --- App Card --- */
.app-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  cursor: pointer;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
  position: relative;
  overflow: hidden;
  border: 2px solid transparent;
  min-height: 180px;
}

.app-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--color-primary-light);
}

.app-card:active {
  transform: translateY(-1px);
}

.app-card .app-icon {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 0.75rem;
}

.app-card .app-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--color-text);
}

.app-card .time-text {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

/* Time Progress Bar */
.time-bar {
  width: 100%;
  height: 8px;
  background: #EAEAEA;
  border-radius: 4px;
  overflow: hidden;
  margin-top: auto;
}

.time-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--color-secondary) 0%, var(--color-accent) 100%);
  transition: width var(--transition-slow);
  min-width: 0;
}

/* Status Badge */
.status-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  align-self: flex-start;
}

.status-badge.available {
  background: #E8F8E9;
  color: var(--color-secondary-dark);
}

.status-badge.exhausted {
  background: var(--color-danger-light);
  color: var(--color-danger);
}

.status-badge.completed {
  background: #DCFCE7;
  color: #15803D;
  font-weight: 700;
}

/* Locked Card */
.app-card.locked {
  filter: grayscale(0.7);
  opacity: 0.6;
  cursor: not-allowed;
  border-color: var(--color-danger);
}

.app-card.locked:hover {
  transform: none;
  box-shadow: var(--shadow-card);
}

/* BUG-11: Only show 'Tempo esaurito' when the card is genuinely exhausted of its daily time budget */
.app-card.exhausted::after,
.app-card.locked.exhausted::after {
  content: '⏰ Tempo esaurito';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(231, 76, 60, 0.9);
  color: #fff;
  text-align: center;
  padding: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.app-card.locked:not(.exhausted):not(.completed)::after {
  display: none !important;
  content: none !important;
}

/* --- Empty State (FE-27) --- */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--color-text-muted);
  font-size: 1.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.empty-state-dino {
  max-width: 320px;
  width: 100%;
  height: auto;
  margin-bottom: 1.5rem;
  border-radius: var(--radius-lg, 16px);
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.08));
}

.empty-state-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--color-primary, #1565c0);
  margin-bottom: 0.5rem;
}

.empty-state-subtitle {
  font-size: 1.3rem;
  font-weight: 600;
  color: #475569;
  margin: 0;
}

/* --- Iframe Overlay --- */
.iframe-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #fff;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.2s ease;
}

.iframe-controls {
  display: none !important; /* FE-05: Hide duplicate host top bar so only the miniapp's top bar is visible */
  height: 56px;
  background: var(--color-dark);
  align-items: center;
  gap: 1rem;
  padding: 0 1rem;
  flex-shrink: 0;
}

.iframe-controls .control-left,
.iframe-controls .control-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.iframe-controls .control-center {
  display: none !important; /* Single timer on the entire page: timer is hosted inside the active miniapp */
}

.iframe-controls .control-right {
  flex: 1;
  justify-content: flex-end;
}

.iframe-controls .app-label {
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.iframe-controls .timer {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  letter-spacing: 0.05em;
}

.iframe-controls .time-remaining {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.65);
  white-space: nowrap;
}

.iframe-controls .timer.warning {
  color: var(--color-accent);
  background: rgba(245, 166, 35, 0.2);
}

.iframe-controls .timer.critical {
  color: var(--color-danger);
  background: rgba(231, 76, 60, 0.2);
  animation: pulse 1s infinite;
}

#app-iframe {
  flex: 1;
  border: none;
  width: 100%;
  height: 100%;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  min-height: var(--min-touch);
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-primary-dark);
}

.btn-secondary {
  background: var(--color-secondary);
  color: #fff;
}

.btn-secondary:hover {
  background: var(--color-secondary-dark);
}

.btn-debug {
  background: rgba(255, 255, 255, 0.12);
  color: var(--color-accent);
  border: 1px solid rgba(245, 166, 35, 0.4);
  font-size: 0.8rem;
}

.btn-debug:hover {
  background: rgba(245, 166, 35, 0.2);
}

.btn-exit {
  background: var(--color-danger);
  color: #fff;
}

.btn-exit:hover {
  background: #C0392B;
}

/* --- Tabs --- */
.tabs {
  display: flex;
  gap: 0;
  padding: 0 2rem;
  border-bottom: 2px solid #E0E0E0;
  margin-top: 1rem;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  min-height: var(--min-touch);
  transition: color var(--transition-fast), border-color var(--transition-fast);
  margin-bottom: -2px;
}

.tab-btn:hover {
  color: var(--color-primary);
}

.tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.tab-content {
  display: none;
  padding: 1.5rem 2rem;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

/* --- Tutor Panel / Schedule Editor --- */
.tutor-panel {
  max-width: 960px;
  margin: 0 auto;
}

.schedule-editor {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 2rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.schedule-editor h3 {
  font-size: 1.3rem;
  margin-bottom: 1.25rem;
  color: var(--color-text);
}

.schedule-type-selector {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
}

.schedule-type-selector label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
  cursor: pointer;
  min-height: var(--min-touch);
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
  color: var(--color-text);
}

.form-group select,
.form-group input[type="date"],
.form-group input[type="number"] {
  width: 100%;
  max-width: 280px;
  padding: 0.6rem 0.8rem;
  border: 1.5px solid #D0D0D0;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: var(--font-stack);
  min-height: var(--min-touch);
  transition: border-color var(--transition-fast);
}

.form-group select:focus,
.form-group input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.15);
}

/* App Assignments (checkboxes in schedule editor) */
.app-assignments {
  margin-bottom: 1.5rem;
}

.app-assignment-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid #F0F0F0;
  min-height: var(--min-touch);
}

.app-assignment-row:last-child {
  border-bottom: none;
}

.app-assignment-row label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  cursor: pointer;
  font-size: 1rem;
}

.app-assignment-row .app-assignment-icon {
  font-size: 1.4rem;
}

.app-assignment-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--color-primary);
}

.app-assignment-row input[type="number"] {
  width: 80px;
  padding: 0.4rem 0.5rem;
  border: 1.5px solid #D0D0D0;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  text-align: center;
  min-height: 36px;
}

.app-assignment-row .time-label {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}

/* --- Renewed Statistics Section (FE-09) --- */
.stats-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: #F8FAFC;
  border: 1.5px solid #E2E8F0;
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.stats-selector-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.stats-label {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--color-text);
}

.stats-day-select {
  padding: 0.55rem 1rem;
  border: 1.5px solid #CBD5E1;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text);
  background: #FFFFFF;
  cursor: pointer;
  min-height: var(--min-touch);
  transition: border-color var(--transition-fast);
}

.stats-day-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.2);
}

.stats-dashboard {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.stats-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(0, 0, 0, 0.05);
  padding: 1.5rem;
}

.stats-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  border-bottom: 1.5px solid #F1F5F9;
  padding-bottom: 0.75rem;
}

.stats-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

/* Daily Summary & KPI Grid */
.stats-summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.stats-student-tag {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.stats-date-badge {
  background: #EFF6FF;
  color: #1D4ED8;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid #BFDBFE;
}

.stats-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.stats-kpi-tile {
  background: #F8FAFC;
  border: 1.5px solid #E2E8F0;
  border-radius: var(--radius-md);
  padding: 1.1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.stats-kpi-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.stats-kpi-icon {
  font-size: 2rem;
  line-height: 1;
}

.stats-kpi-data {
  display: flex;
  flex-direction: column;
}

.stats-kpi-val {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--color-primary-dark);
  line-height: 1.2;
}

.stats-kpi-lbl {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Time-by-App Horizontal Bar Chart */
.stats-chart-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.stats-bar-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.stats-bar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.95rem;
}

.stats-app-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--color-text);
}

.stats-time-metric {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  color: var(--color-text);
}

.stats-bar-track {
  width: 100%;
  height: 16px;
  background: #E2E8F0;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.stats-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3B82F6 0%, #2563EB 100%);
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 4px;
}

.stats-bar-fill.accent-green {
  background: linear-gradient(90deg, #10B981 0%, #059669 100%);
}

.stats-bar-fill.accent-purple {
  background: linear-gradient(90deg, #8B5CF6 0%, #7C3AED 100%);
}

.stats-bar-fill.accent-amber {
  background: linear-gradient(90deg, #F59E0B 0%, #D97706 100%);
}

.stats-bar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* Task Openings & Concentration Report */
.stats-openings-hero {
  background: #F0FDF4;
  border: 1.5px solid #BBF7D0;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.stats-openings-num {
  font-size: 2.4rem;
  font-weight: 900;
  color: #166534;
  line-height: 1;
}

.stats-openings-desc {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stats-openings-desc strong {
  font-size: 1rem;
  color: #14532D;
}

.stats-openings-desc p {
  font-size: 0.88rem;
  color: #166534;
  margin: 0;
}

.stats-openings-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
}

.stats-openings-item {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.stats-openings-badge {
  background: #EFF6FF;
  color: #1D4ED8;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
}

/* Trends Section (Week-over-Week) */
.stats-trends-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stats-trend-tile {
  background: #F8FAFC;
  border: 1.5px solid #E2E8F0;
  border-radius: var(--radius-md);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.stats-trend-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stats-trend-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.stats-trend-pill {
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.stats-trend-pill.up {
  background: #DCFCE7;
  color: #15803D;
}

.stats-trend-pill.down {
  background: #FEE2E2;
  color: #B91C1C;
}

.stats-trend-pill.stable {
  background: #E0F2FE;
  color: #0369A1;
}

.stats-trend-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--color-text);
}

.stats-trend-sub {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.stats-insights-container {
  background: #FFFBEB;
  border: 1.5px solid #FDE68A;
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.stats-insights-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #92400E;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.stats-insights-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stats-insight-item {
  font-size: 0.9rem;
  color: #78350F;
  line-height: 1.4;
}

.stats-empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  background: #FFFFFF;
  border-radius: var(--radius-md);
  border: 2px dashed #E2E8F0;
}

.stats-empty-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
}

.stats-empty-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

.stats-empty-desc {
  font-size: 0.92rem;
  color: var(--color-text-muted);
  max-width: 400px;
  margin: 0 auto;
}

/* --- Modal Overlay --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}

.modal-box {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-overlay);
  padding: 2rem;
  max-width: 400px;
  width: 90%;
  text-align: center;
}

.modal-box h3 {
  margin-bottom: 1rem;
}

.modal-box .modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1.5rem;
}

/* --- Toast Notifications --- */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--color-dark);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-overlay);
  pointer-events: auto;
  animation: slideUp 0.25s ease;
  max-width: 360px;
  word-break: break-word;
}

.toast-success {
  border-left: 4px solid var(--color-secondary);
}

.toast-error {
  border-left: 4px solid var(--color-danger);
}

.toast-info {
  border-left: 4px solid var(--color-primary);
}

.toast-fade {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* --- Animations --- */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .header {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .student-name {
    font-size: 1rem;
  }

  .header-actions {
    gap: 0.5rem;
  }

  .date-display {
    font-size: 0.8rem;
  }

  .mode-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
  }

  .section-title {
    font-size: 1.2rem;
    padding: 1rem 1rem 0.5rem;
  }

  .dashboard {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    padding: 0.75rem 1rem 1.5rem;
  }

  .app-card {
    padding: 1.15rem;
    min-height: 150px;
  }

  .app-card .app-icon {
    font-size: 2.4rem;
  }

  .app-card .app-title {
    font-size: 1rem;
  }

  .tabs {
    padding: 0 1rem;
  }

  .tab-btn {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
  }

  .tab-content {
    padding: 1rem;
  }

  .schedule-editor {
    padding: 1.25rem;
  }

  .iframe-controls {
    height: 48px;
    padding: 0 0.5rem;
    gap: 0.5rem;
  }

  .iframe-controls .timer {
    font-size: 1.1rem;
    padding: 0.3rem 0.6rem;
  }

  .iframe-controls .app-label {
    font-size: 0.85rem;
  }

  .toast-container {
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
  }

  .toast {
    max-width: 100%;
  }

  .tutor-header-bar {
    padding: 0.75rem 1rem;
    gap: 0.75rem;
  }

  .tutor-header-bar h2 {
    font-size: 1.1rem;
  }

  #tutor-logout-btn {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .dashboard {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem 1rem;
  }

  .schedule-type-selector {
    flex-direction: column;
    gap: 0.5rem;
  }

  .app-assignment-row {
    flex-wrap: wrap;
  }

  .stats-controls {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ============================================================
   Tutor Personal Area & Student Management (FE-01)
   ============================================================ */
.tutor-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #FFFFFF;
  padding: 1rem 2rem;
  border-bottom: 1px solid #E0E0E0;
  margin-bottom: 1.25rem;
  gap: 1rem;
}

.tutor-header-bar h2 {
  font-size: 1.3rem;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  flex: 0 1 auto;
}

#tutor-logout-btn {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  width: auto;
  max-width: fit-content;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.tutor-students-section {
  padding: 1.25rem 2rem;
  background: var(--color-bg-card);
  margin: 0 2rem 1.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.tutor-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.tutor-section-header h3 {
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tutor-students-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.student-manage-card {
  border: 2px solid #EAEAEA;
  border-radius: var(--radius-md);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  background: #FAFAFA;
  transition: all var(--transition-fast);
}

.student-manage-card:hover {
  border-color: var(--color-primary-light);
  box-shadow: var(--shadow-card);
}

.student-manage-card.selected {
  border-color: var(--color-primary);
  background: #F0F7FF;
  box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.25);
}

.student-manage-card .student-manage-avatar {
  font-size: 2.8rem;
  margin-bottom: 0.4rem;
  line-height: 1;
}

.student-manage-card .student-manage-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.2rem;
}

.student-manage-card .student-manage-id {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  margin-bottom: 0.5rem;
}

.student-manage-card .student-badge-active {
  font-size: 0.75rem;
  background: #E8F8E9;
  color: var(--color-secondary-dark);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.student-manage-actions {
  display: flex;
  gap: 0.4rem;
  width: 100%;
  margin-top: auto;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  min-height: 32px;
  flex: 0 0 auto;
}

.student-manage-actions .btn-sm {
  flex: 1;
}

.btn-danger-outline {
  background: transparent;
  color: var(--color-danger);
  border: 1px solid var(--color-danger);
}

.btn-danger-outline:hover {
  background: var(--color-danger);
  color: #fff;
}

.active-student-context-bar {
  background: #EBF5FB;
  border-left: 4px solid var(--color-primary);
  padding: 0.8rem 1.5rem;
  margin: 0 2rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Avatar picker inside modals */
.avatar-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 0 1rem;
  justify-content: center;
}

.avatar-opt {
  font-size: 1.8rem;
  background: #F0F0F0;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.avatar-opt:hover {
  background: #E0E0E0;
  transform: scale(1.1);
}

.avatar-opt.selected {
  border-color: var(--color-primary);
  background: #D9EDF7;
  transform: scale(1.15);
}

/* Quick login buttons */
.quick-login-container {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.quick-login-btn {
  background: #F0F4F8;
  border: 1px solid #D0D8E0;
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.6rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.quick-login-btn:hover {
  background: #E2EAF2;
  border-color: var(--color-primary);
}

.btn-switch-student {
  background: rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  cursor: pointer;
  margin-left: 0.5rem;
  transition: background var(--transition-fast);
}

.btn-switch-student:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* ============================================================
   Custom Offline Tasks & Templates (FE-02)
   ============================================================ */
.activities-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.activities-subheading h4,
.templates-section-header h4 {
  font-size: 1.15rem;
  color: var(--color-text);
  margin-bottom: 0.75rem;
}

.activities-cards-grid,
.templates-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.activity-manage-card,
.template-manage-card {
  background: #FFFFFF;
  border: 2px solid #EAEAEA;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.activity-manage-card:hover,
.template-manage-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-card);
}

.activity-manage-header,
.template-manage-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.activity-manage-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text);
}

.activity-duration-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: #EBF5FB;
  color: var(--color-primary);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.activity-desc-preview {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  line-height: 1.4;
  margin-bottom: 0.85rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.activity-manage-actions,
.template-manage-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid #F0F0F0;
  flex-wrap: wrap;
}

/* Student Dashboard: Offline Activity Card */
.app-card.offline-activity-card {
  border-top: 5px solid #27AE60;
  background: linear-gradient(180deg, #FFFFFF 0%, #F9FDF9 100%);
}

.offline-activity-badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #27AE60;
  background: rgba(39, 174, 96, 0.12);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  display: inline-block;
  margin-bottom: 0.4rem;
}

.app-card.offline-activity-card.completed {
  border-top-color: #27AE60;
  border-color: #86EFAC;
  background: linear-gradient(180deg, #FFFFFF 0%, #F0FDF4 100%);
  opacity: 0.95;
}

.completed-badge {
  color: #27AE60;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* Student Activity Modal */
.student-activity-box {
  animation: modalEnter 0.25s ease-out;
}

.student-activity-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.activity-type-badge {
  background: #E8F8E9;
  color: #27AE60;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0.25rem;
}

.student-activity-heading {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--color-text);
  margin-bottom: 0.75rem;
}

.student-activity-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.btn-voice {
  background: #FFF3CD;
  color: #856404;
  border: 1.5px solid #FFEEBA;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.35rem 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-voice:hover {
  background: #FFE8A1;
  transform: scale(1.02);
}

.btn-voice.speaking {
  background: #F39C12;
  color: #FFFFFF;
  border-color: #E67E22;
  animation: pulse 1s infinite alternate;
}

.activity-desc-content {
  font-size: 1.05rem;
  line-height: 1.6;
  color: #2C3E50;
  background: #F8F9FA;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  white-space: pre-wrap;
}

.activity-attachment-wrap {
  background: #FFFFFF;
  border: 1px dashed #BDC3C7;
  border-radius: var(--radius-md);
  padding: 0.85rem;
  margin-bottom: 1.25rem;
}

.student-activity-footer {
  display: flex;
  justify-content: center;
  padding-top: 1rem;
}

.btn-start-task {
  width: 100%;
  max-width: 320px;
  background: #27AE60;
  color: #FFFFFF;
  font-size: 1.25rem;
  font-weight: 800;
  padding: 0.9rem 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(39, 174, 96, 0.35);
  transition: all var(--transition-fast);
}

.btn-start-task:hover {
  background: #219653;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(39, 174, 96, 0.45);
}

/* Offline Countdown Overlay */
.offline-countdown-overlay {
  position: fixed;
  inset: 0;
  background: rgba(18, 24, 38, 0.88);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
}

.countdown-card {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 2.25rem 2rem;
  max-width: 520px;
  width: 100%;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
  animation: modalEnter 0.3s ease-out;
}

.countdown-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.countdown-app-badge {
  background: #E8F8E9;
  color: #27AE60;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
}

.countdown-title {
  font-size: 1.35rem;
  color: var(--color-text);
  margin-bottom: 1.5rem;
}

.countdown-digits-wrap {
  background: #F8F9FA;
  border: 3px solid #EAEAEA;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.countdown-digits {
  font-family: var(--font-mono);
  font-size: 4rem;
  font-weight: 800;
  color: #2C3E50;
  letter-spacing: 0.05em;
  line-height: 1;
}

.countdown-digits.warning {
  color: #E67E22;
  animation: pulse 1s infinite alternate;
}

.countdown-digits.expired {
  color: var(--color-danger);
  animation: shake 0.5s;
}

.countdown-progress-bar {
  height: 10px;
  background: #EAEAEA;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.countdown-progress-fill {
  height: 100%;
  background: #27AE60;
  transition: width 1s linear, background-color 0.5s ease;
}

.countdown-status-text {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}

.countdown-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn-finish-task {
  background: #27AE60;
  font-size: 1.05rem;
  padding: 0.6rem 1.4rem;
}

.btn-finish-task:hover {
  background: #219653;
}

/* ============================================================
   FE-03: Student PIN Authentication Styles
   ============================================================ */

.student-login-view {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 120px);
  padding: 2rem 1rem;
}

.student-login-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-xl);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.12);
  padding: 2.5rem 2rem;
  max-width: 480px;
  width: 100%;
  text-align: center;
  border: 2px solid #F0F4F8;
  animation: modalEnter 0.35s ease-out;
}

.login-mascot-badge {
  line-height: 1;
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: bounce 2s infinite ease-in-out;
}

.login-mascot-img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.15));
  display: block;
}

.login-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--color-text);
  margin-bottom: 0.35rem;
}

.login-subtitle {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}

/* PIN Display (6 boxes) */
.pin-display-wrapper {
  position: relative;
  display: inline-block;
  margin-bottom: 1.25rem;
  outline: none;
  cursor: pointer;
}

.pin-display {
  display: flex;
  gap: 0.65rem;
  justify-content: center;
}

.pin-box {
  width: 48px;
  height: 58px;
  background: #F8FAFC;
  border: 2.5px solid #CBD5E1;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--color-primary-dark);
  transition: all var(--transition-fast);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.pin-box.filled {
  background: #FFFFFF;
  border-color: var(--color-primary);
  color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.15);
  animation: popIn 0.15s ease-out;
}

.pin-box.active {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.25);
}

.pin-display.shake {
  animation: shake 0.45s ease-in-out;
}

.pin-display.shake .pin-box {
  border-color: var(--color-danger);
  background: var(--color-danger-light);
  color: var(--color-danger);
}

.pin-display.success-anim .pin-box {
  border-color: #27AE60;
  background: #E8F8E9;
  color: #27AE60;
}

/* Feedback / Error */
.pin-feedback {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  display: inline-block;
  max-width: 100%;
}

.pin-feedback.error {
  color: var(--color-danger);
  background: var(--color-danger-light);
}

.pin-feedback.success {
  color: #27AE60;
  background: #E8F8E9;
}

.pin-feedback.info {
  color: #1D4ED8;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
}

.pin-feedback.locked {
  color: #991B1B;
  background: #FEE2E2;
  border: 1.5px solid #FCA5A5;
  font-weight: 700;
  animation: pulse 1.5s infinite;
}

/* Keypad (3x4) */
.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  max-width: 320px;
  margin: 0 auto 1.25rem;
  transition: opacity var(--transition-fast);
}

.pin-keypad.locked {
  pointer-events: none;
  opacity: 0.45;
  filter: grayscale(0.6);
  cursor: not-allowed;
  user-select: none;
}

.keypad-btn {
  background: #F1F5F9;
  border: 1.5px solid #E2E8F0;
  border-radius: var(--radius-lg);
  font-size: 1.6rem;
  font-weight: 700;
  color: #1E293B;
  min-height: 56px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  touch-action: manipulation;
  transition: all var(--transition-fast);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.05);
}

.keypad-btn:hover {
  background: #E2E8F0;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
}

.keypad-btn:active {
  transform: translateY(1px);
  background: #CBD5E1;
}

.keypad-action-btn {
  font-size: 1.4rem;
  color: var(--color-danger);
  background: #FEE2E2;
  border-color: #FECACA;
}

.keypad-action-btn:hover {
  background: #FCA5A5;
}

.keypad-submit-btn {
  font-size: 1.4rem;
  background: #DCFCE7;
  color: #15803D;
  border-color: #BBF7D0;
}

.keypad-submit-btn:hover {
  background: #86EFAC;
}

.login-footer-hint {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* Tutor View: Student PIN Badge */
.student-pin-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
  margin: 0.5rem 0;
  padding: 0;
  background: transparent;
  border: none;
}

.student-pin-badge .btn-regen-pin {
  width: 100%;
  box-sizing: border-box;
  justify-content: center;
  font-size: 0.82rem;
  padding: 0.35rem 0.6rem;
  margin: 0;
}

.pin-badge-icon {
  font-size: 0.95rem;
  margin-right: 0.25rem;
}

.pin-badge-text {
  font-weight: 600;
  color: var(--color-text-muted);
}

.student-pin-code {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--color-primary-dark);
  background: #FFFFFF;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  border: 1px solid #CBD5E1;
}

.student-pin-code.masked {
  letter-spacing: 0.22em;
  color: #64748B;
  background: #F1F5F9;
  border-color: #E2E8F0;
  user-select: none;
  font-size: 1rem;
}

.btn-regen-pin {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  margin-left: 0.5rem;
}

/* FE-06: PIN Hover Popover Menu */
.pin-hover-menu {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 260px;
  max-width: calc(100vw - 32px);
  box-sizing: border-box;
  background: #FFFFFF;
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.25), 0 6px 12px rgba(0, 0, 0, 0.1);
  padding: 1rem;
  z-index: 100;
  text-align: center;
  animation: pinPopCenter 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pinPopCenter {
  0% { transform: translate(-50%, -50%) scale(0.85); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes pinPopOutCenter {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(0.9); opacity: 0; }
}

.pin-hover-menu.closing {
  animation: pinPopOutCenter 0.15s ease-in forwards;
}

.pin-hover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid #E2E8F0;
  width: 100%;
  box-sizing: border-box;
}

.pin-hover-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pin-hover-close {
  background: none;
  border: none;
  font-size: 1.35rem;
  line-height: 1;
  color: #94A3B8;
  cursor: pointer;
  padding: 0 0.25rem;
  border-radius: 4px;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.pin-hover-close:hover {
  color: var(--color-danger);
  background: #FEE2E2;
}

.pin-hover-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin: 0.6rem 0;
  width: 100%;
  box-sizing: border-box;
}

.pin-hover-digits {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  color: #1E293B;
  background: #EFF6FF;
  border: 1.5px solid #93C5FD;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  user-select: all;
}

.pin-hover-copy {
  width: 100%;
  box-sizing: border-box;
  justify-content: center;
  padding: 0.35rem 0.6rem;
  font-size: 0.82rem;
}

.pin-hover-note {
  font-size: 0.76rem;
  line-height: 1.38;
  color: #64748B;
  margin: 0.5rem 0 0.8rem 0;
  background: #F8FAFC;
  padding: 0.5rem;
  border-radius: 6px;
  border-left: 3px solid var(--color-primary);
  text-align: left;
  width: 100%;
  box-sizing: border-box;
}

.pin-hover-dismiss {
  width: 100%;
  box-sizing: border-box;
  font-weight: 600;
  padding: 0.45rem;
  font-size: 0.88rem;
}

@keyframes popIn {
  0% { transform: scale(0.85); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* ============================================================
   FE-04: Schedulable Offline Tasks Styles
   ============================================================ */

.schedule-category-header {
  margin: 1.5rem 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.schedule-category-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.schedule-category-hint {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.app-assignment-row.offline-task-row {
  border-left: 4px solid var(--color-secondary);
  background: #FAFCF9;
}

.app-assignment-row.offline-task-row:hover {
  background: #F1F8EE;
}

.activity-schedule-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: #EFF6FF;
  color: #1D4ED8;
  margin-top: 0.35rem;
}

.offline-attachment-pill {
  font-size: 0.75rem;
  background: #F1F5F9;
  color: var(--color-text-muted);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  margin-left: 0.5rem;
}

/* --- FE-13 Attention Stats Section --- */
.attention-stats-card {
  border-left: 4px solid #10b981;
}

.attention-trend-insight {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #f0fdf4;
  border: 1.5px solid #bbf7d0;
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
}

.attention-trend-icon {
  font-size: 1.8rem;
  line-height: 1;
}

.attention-trend-text strong {
  color: #166534;
  font-size: 0.95rem;
  display: block;
  margin-bottom: 4px;
}

.attention-trend-text p {
  color: #15803d;
  font-size: 0.9rem;
  line-height: 1.4;
  margin: 0;
}

.attention-trials-wrap {
  margin-top: 1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 1rem;
}

.attention-trials-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.75rem;
}

.attention-trials-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 110px;
  overflow-x: auto;
  padding: 8px 4px;
}

.attention-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 0 0 32px;
  height: 100%;
  justify-content: flex-end;
}

.attention-bar {
  width: 100%;
  border-radius: 4px 4px 0 0;
  transition: height 0.3s ease;
}

.attention-bar.fast {
  background: #22c55e;
}

.attention-bar.normal {
  background: #3b82f6;
}

.attention-bar.slow {
  background: #f59e0b;
}

.attention-bar.miss {
  background: #ef4444;
}

.attention-bar-lbl {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  font-weight: 600;
}

/* ==========================================================================
   Activity Completed Pause Overlay (FE-10)
   ========================================================================== */
.pause-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: pauseOverlayFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pauseOverlayFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.pause-card {
  background: #ffffff;
  border-radius: 28px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.45);
  max-width: 480px;
  width: 100%;
  padding: 2.25rem 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 4px solid #f59e0b;
  position: relative;
  box-sizing: border-box;
  animation: pauseCardPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: 92vh;
  overflow-y: auto;
}

@keyframes pauseCardPop {
  0% {
    transform: scale(0.9) translateY(20px);
    opacity: 0;
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

/* Center dino mascot in timeout popup (FE-33) */
.pause-dino-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 0.25rem auto 1.25rem;
}

.pause-dino-img {
  max-width: 175px;
  max-height: 175px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.12));
  animation: dinoFloat 3s ease-in-out infinite;
}

@keyframes dinoFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

.pause-coffee-badge {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 3px solid #f59e0b;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.25);
  margin-bottom: 0.75rem;
}

.pause-coffee-icon {
  font-size: 3.25rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
  animation: coffeeSteam 3s ease-in-out infinite;
}

@keyframes coffeeSteam {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-4px) rotate(-3deg);
  }
}

.pause-title {
  font-size: 1.9rem;
  font-weight: 800;
  color: #1e293b;
  margin: 0.25rem 0 0.35rem;
}

.pause-subtitle {
  font-size: 1.1rem;
  font-weight: 600;
  color: #64748b;
  margin: 0 0 1.5rem;
}

.pause-countdown-box {
  background: #fffbeb;
  border: 2px dashed #fcd34d;
  border-radius: 18px;
  padding: 1.25rem 1.5rem;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 1.5rem;
}

.pause-countdown-header {
  margin-bottom: 0.35rem;
}

.pause-countdown-badge {
  display: inline-block;
  background: #fde68a;
  color: #92400e;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pause-countdown-digits {
  font-size: 2.4rem;
  font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #b45309;
  letter-spacing: 1px;
  margin: 0.3rem 0;
}

.pause-progress-bar {
  height: 10px;
  width: 100%;
  background: #fef3c7;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.6rem;
}

.pause-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #d97706);
  transition: width 0.3s linear;
}

.pause-hint-text {
  font-size: 0.88rem;
  color: #78350f;
  margin: 0.6rem 0 0;
  line-height: 1.4;
}

.pause-actions {
  width: 100%;
}

.btn-next-activity {
  width: 100%;
  padding: 1rem 1.5rem;
  font-size: 1.15rem;
  font-weight: 700;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  transition: all 0.3s ease;
  border: none;
}

.btn-next-activity:disabled {
  background: #94a3b8;
  color: #ffffff;
  opacity: 0.65;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-next-activity.unlocked {
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(22, 163, 74, 0.4);
  animation: pulseUnlockedBtn 1.8s infinite;
}

.btn-next-activity.unlocked:hover {
  background: linear-gradient(135deg, #15803d, #166534);
  transform: translateY(-2px);
}

@keyframes pulseUnlockedBtn {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 10px 25px rgba(22, 163, 74, 0.4);
  }
  50% {
    transform: scale(1.03);
    box-shadow: 0 14px 30px rgba(22, 163, 74, 0.6);
  }
}

.pause-next-preview {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: #475569;
  background: #f1f5f9;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
}

.pause-next-label {
  color: #64748b;
  margin-right: 0.35rem;
}

/* ============================================================================
   FE-22: Strict Schedule Ordering & Tutor Sequence Management
   ============================================================================ */

/* Child Dashboard: Card Order & Status Enhancements */
.app-card .step-badge {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 800;
  background: #E0F2FE;
  color: #0369A1;
  padding: 3px 10px;
  min-width: 24px;
  text-align: center;
  border-radius: 999px;
  margin-bottom: 0.45rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.app-card.active-step {
  border: 2.5px solid #2563EB !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2), var(--shadow-card-hover) !important;
  transform: translateY(-2px);
}

.status-badge.active-step-badge {
  background: #DBEAFE;
  color: #1D4ED8;
  font-weight: 700;
}

.status-badge.locked-badge {
  background: #F1F5F9;
  color: #64748B;
  font-weight: 600;
}

.app-card.locked-by-order {
  filter: grayscale(0.85);
  opacity: 0.6;
  cursor: not-allowed !important;
  border-color: #94A3B8 !important;
}

.app-card.locked-by-order:hover {
  transform: none !important;
  box-shadow: var(--shadow-card) !important;
}

/* FE-28: Removed 'Bloccata dall\'ordine' overlay text */
.app-card.locked-by-order::after {
  display: none !important;
  content: none !important;
}

.app-card.completed.locked::after {
  content: '✅ Attività completata';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(22, 163, 74, 0.94);
  color: #FFFFFF;
  text-align: center;
  padding: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
}

/* Tutor Schedule Editor: Strict Sequence Order Controls */
.schedule-order-section {
  background: #F8FAFC;
  border: 2px solid #CBD5E1;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.schedule-order-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.schedule-order-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FFFFFF;
  border: 1.5px solid #E2E8F0;
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.9rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all var(--transition-fast);
}

.schedule-order-row:hover {
  border-color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.schedule-order-row-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1;
}

.schedule-order-badge {
  background: #DBEAFE;
  color: #1D4ED8;
  font-weight: 800;
  font-size: 0.8rem;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.schedule-order-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  margin-left: 0.4rem;
}

.schedule-order-tag.tag-digital {
  background: #E0E7FF;
  color: #4338CA;
}

.schedule-order-tag.tag-offline {
  background: #FEF3C7;
  color: #B45309;
}

.schedule-order-tag.tag-timeout {
  background: #FEE2E2;
  color: #991B1B;
}

.app-card.card-timeout {
  border-color: #FCD34D;
  background: linear-gradient(180deg, #FFFFFF 0%, #FFFBEB 100%);
}

.app-card.card-timeout .app-icon {
  background: #FEF3C7;
}

.app-card.card-timeout.active-step {
  border-color: #F59E0B;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.25);
}

.schedule-order-row-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.schedule-order-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-reorder {
  background: #F1F5F9;
  border: 1.5px solid #CBD5E1;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-reorder:hover:not(:disabled) {
  background: #E2E8F0;
  border-color: #64748B;
  transform: translateY(-1px);
}

.btn-reorder:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ============================================================================
   FE-23: Multi-Occurrence Activity Scheduling & Enhanced Planning UI
   ============================================================================ */

.btn-remove-step {
  background: #FEE2E2;
  color: #DC2626;
  border: 1.5px solid #FCA5A5;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-remove-step:hover {
  background: #FCA5A5;
  color: #991B1B;
  transform: translateY(-1px);
}

.step-mins-input {
  width: 58px;
  padding: 4px 6px;
  font-size: 0.85rem;
  border: 1.5px solid #CBD5E1;
  border-radius: 4px;
  text-align: center;
  font-weight: 700;
  color: #1E293B;
}

.step-mins-input:focus {
  border-color: #2563EB;
  outline: none;
}

.catalog-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FFFFFF;
  border: 1.5px solid #E2E8F0;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: all var(--transition-fast);
}

.catalog-item-row:hover {
  border-color: #93C5FD;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.catalog-item-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.catalog-item-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.catalog-item-details {
  display: flex;
  flex-direction: column;
}

.catalog-item-title {
  font-weight: 700;
  color: #1E293B;
  font-size: 0.95rem;
}

.catalog-item-sub {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.catalog-item-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-add-activity {
  background: #2563EB;
  color: #FFFFFF;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all var(--transition-fast);
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

.btn-add-activity:hover {
  background: #1D4ED8;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(37, 99, 235, 0.3);
}

.app-added-count {
  background: #EFF6FF;
  color: #1D4ED8;
  border: 1px solid #BFDBFE;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  white-space: nowrap;
}

.empty-schedule-hint {
  padding: 1.5rem 1rem;
  text-align: center;
  color: #64748B;
  font-size: 0.9rem;
  background: #F8FAFC;
  border: 1.5px dashed #CBD5E1;
  border-radius: var(--radius-sm);
  margin-top: 0.5rem;
}

/* ==========================================================================
   FE-25: Tutor Schedule Editor 2-Column Layout & Activity Basket
   ========================================================================== */
.schedule-editor-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.5rem;
  align-items: start;
  margin-top: 1rem;
}

@media (max-width: 960px) {
  .schedule-editor-grid {
    grid-template-columns: 1fr;
  }
}

.schedule-column-left {
  display: flex;
  flex-direction: column;
}

.schedule-column-right {
  display: flex;
  flex-direction: column;
}

.activity-basket-section {
  background: #F8FAFC;
  border: 2px solid #E2E8F0;
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.activity-basket-header {
  margin-bottom: 0.85rem;
}

.activity-basket-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--color-text);
}

.activity-basket-hint {
  display: block;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
}

.activity-basket-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 600px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.basket-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FFFFFF;
  border: 1.5px solid #E2E8F0;
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  cursor: grab;
  transition: all var(--transition-fast);
  user-select: none;
}

.basket-item-row:hover {
  border-color: var(--color-primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.basket-item-row.dragging {
  opacity: 0.4;
  cursor: grabbing;
}

.basket-item-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1;
  min-width: 0;
}

.basket-item-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.basket-item-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.basket-item-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.basket-item-sub {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.basket-item-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-add-basket {
  background: var(--color-primary);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: background var(--transition-fast);
}

.btn-add-basket:hover {
  background: var(--color-primary-dark);
}

/* ==========================================================================
   FE-29: Activity Filters in Activity Basket (Topic & Class Level)
   ========================================================================== */
.activity-filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
  margin: 0.65rem 0 1rem 0;
  padding: 0.65rem 0.85rem;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
}

.activity-filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.activity-filter-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-text-muted);
  user-select: none;
}

.activity-filter-select {
  padding: 5px 10px;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--color-text);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition-fast);
}

.activity-filter-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.basket-item-badges {
  display: flex;
  gap: 4px;
  margin-top: 3px;
  flex-wrap: wrap;
}

.basket-item-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  display: inline-block;
  line-height: 1.2;
}

.basket-item-badge.category-badge {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.basket-item-badge.class-badge {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.basket-item-badge.all-badge {
  background: #f3e8ff;
  color: #6b21a8;
  border: 1px solid #e9d5ff;
}

/* Drag & Drop helpers for schedule list & rows */
.schedule-drop-zone {
  min-height: 180px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.schedule-drop-zone.drag-over {
  background: #EFF6FF !important;
  border: 2px dashed #3B82F6 !important;
}

.schedule-order-row {
  cursor: grab;
}

.schedule-order-row.dragging {
  opacity: 0.4;
  cursor: grabbing;
}

.schedule-order-row.drag-target-above {
  border-top: 3px solid #3B82F6 !important;
}

.schedule-order-row.drag-target-below {
  border-bottom: 3px solid #3B82F6 !important;
}

.drag-handle {
  cursor: grab;
  color: #94A3B8;
  font-size: 1.15rem;
  margin-right: 0.35rem;
  user-select: none;
}
.drag-handle:hover {
  color: var(--color-text);
}

/* ==========================================================================
   TUTOR TEST AREA (FE-32: Prova Attività)
   ========================================================================== */
.btn-try-apps {
  background: #2563EB !important;
  color: #FFFFFF !important;
  border: none !important;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}
.btn-try-apps:hover {
  background: #1D4ED8 !important;
  transform: translateY(-1px);
}

.test-apps-panel {
  background: #FFFFFF;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
  border: 1px solid #E2E8F0;
  margin-top: 16px;
}

.test-apps-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid #F1F5F9;
}

.test-apps-header h3 {
  font-size: 1.35rem;
  font-weight: 800;
  color: #1E293B;
  margin: 8px 0;
}

.test-apps-header p {
  font-size: 0.95rem;
  color: #64748B;
  line-height: 1.5;
  margin: 0;
}

.test-apps-badge {
  display: inline-block;
  padding: 4px 12px;
  background: #EFF6FF;
  color: #2563EB;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}

.test-apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.test-app-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px;
  background: #F8FAFC;
  border: 2px solid #E2E8F0;
  border-radius: 16px;
  transition: all 0.2s ease;
}

.test-app-card:hover {
  transform: translateY(-3px);
  border-color: #3B82F6;
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.12);
  background: #FFFFFF;
}

.test-app-icon {
  font-size: 42px;
  margin-bottom: 10px;
}

.test-app-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1E293B;
  margin-bottom: 6px;
}

.test-app-time {
  font-size: 0.85rem;
  color: #64748B;
  font-weight: 600;
  margin-bottom: 14px;
  background: #E2E8F0;
  padding: 3px 10px;
  border-radius: 12px;
}

.btn-run-test-app {
  width: 100%;
  padding: 10px 16px;
  background: linear-gradient(135deg, #2563EB, #1D4ED8);
  color: #FFFFFF;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: opacity 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-run-test-app:hover {
  opacity: 0.92;
}

/* ============================================================
   Admin Area Styles (FE-31)
   ============================================================ */

.btn-admin-entry {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.btn-admin-entry:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.6);
}

.admin-view {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1.5rem;
}

.admin-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  padding: 1.25rem 1.75rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.admin-header-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.admin-header-title h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-dark);
}

.badge-role-admin {
  background: #8e44ad;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.admin-user-tag {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  background: #f1f5f9;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}

.admin-tabs-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 0.25rem;
}

.admin-tab-btn {
  background: none;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-muted);
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.admin-tab-btn:hover {
  color: var(--color-primary-dark);
  background: #f8fafc;
}

.admin-tab-btn.active {
  color: var(--color-primary-dark);
  border-bottom: 3px solid var(--color-primary-dark);
  background: #fff;
}

.admin-tab-content {
  display: block;
}

.admin-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.admin-panel-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-dark);
}

.admin-table-container {
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}

.admin-table th {
  background: #f8fafc;
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.9rem 1.2rem;
  border-bottom: 1px solid #e2e8f0;
}

.admin-table td {
  padding: 0.9rem 1.2rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-table tr:hover td {
  background: #fbfcfe;
}

.badge-status-active {
  background: #e6f9ed;
  color: #1e7e34;
  border: 1px solid #c3e6cb;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  display: inline-block;
}

.badge-status-disabled {
  background: #fdf2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  display: inline-block;
}

.audit-action-badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.audit-action-login-ok { background: #dcfce7; color: #166534; }
.audit-action-login-fail { background: #fee2e2; color: #991b1b; }
.audit-action-create { background: #e0f2fe; color: #075985; }
.audit-action-modify { background: #fef3c7; color: #92400e; }
.audit-action-disable { background: #ffedd5; color: #9a3412; }
.audit-action-enable { background: #ecfdf5; color: #065f46; }
.audit-action-delete { background: #ffe4e6; color: #9f1239; }

.admin-actions-cell {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* ============================================================
   Admin First-Time Setup Wizard Styles (FE-37)
   ============================================================ */

.admin-setup-box {
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
  padding: 2rem;
  background: #ffffff;
}

.admin-setup-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.admin-setup-header h3 {
  font-size: 1.35rem;
  color: var(--color-dark);
  font-weight: 700;
}

.setup-subtitle {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
}

.setup-steps-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.75rem;
  gap: 0.5rem;
}

.step-indicator-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #94a3b8;
}

.step-indicator-item .step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
}

.step-indicator-item.active {
  color: var(--color-primary-dark);
}

.step-indicator-item.active .step-num {
  background: var(--color-primary-dark);
  color: #ffffff;
}

.step-indicator-item.completed .step-num {
  background: #10b981;
  color: #ffffff;
}

.step-divider {
  width: 24px;
  height: 2px;
  background: #e2e8f0;
}

.setup-card-intro {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: left;
}

.setup-card-intro h4 {
  font-size: 1.1rem;
  color: var(--color-dark);
  margin-bottom: 0.75rem;
}

.setup-feature-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.setup-feature-list li {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  font-size: 0.9rem;
  line-height: 1.45;
}

.setup-feature-list li span {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.setup-info-banner {
  background: #eff6ff;
  border-left: 4px solid var(--color-primary-dark);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: #1e3a8a;
  margin-top: 1rem;
}

.mfa-tutorial-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.mfa-instructions ol {
  text-align: left;
  padding-left: 1.25rem;
  font-size: 0.88rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.mfa-secret-display-box {
  background: #ffffff;
  border: 1.5px dashed #3b82f6;
  border-radius: var(--radius-sm);
  padding: 1rem;
  text-align: center;
  margin-top: 0.75rem;
}

.mfa-secret-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--color-text-muted);
  letter-spacing: 0.5px;
  font-weight: 700;
  display: block;
}

.mfa-secret-code {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: #1e40af;
  margin: 0.4rem 0;
  word-break: break-all;
  user-select: all;
}

.setup-error-msg {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-top: 0.75rem;
  text-align: center;
}

.setup-success-card {
  text-align: center;
  padding: 1rem 0;
}

.setup-success-details {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
  padding: 1rem 1.5rem;
  margin: 1.25rem auto;
  text-align: left;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.9rem;
}







