:root{
  --bg:#f6f7fb;
  --card:#fff;
  --text:#0f172a;
  --muted:#64748b;
  --border:#e5e7eb;
  --primary:#2563eb;
  --primary2:#1d4ed8;
  --danger:#dc2626;
  --shadow: 0 8px 24px rgba(15, 23, 42, .06);
  --radius: 14px;
}

*{ box-sizing: border-box; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

.wrap{
  max-width: 980px;
  margin: 22px auto;
  padding: 0 14px 40px;
}

.card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  padding: 16px;
  margin-bottom: 14px;
}

.card.header{
  border-bottom: 4px solid rgba(37, 99, 235, 0.12);
}

.card.focus{
  border: 1px solid rgba(37,99,235,.22);
  box-shadow: 
    0 0 0 1px rgba(37,99,235,.05),    
    0 6px 18px rgba(15,23,42,.08);    
  margin-top: 22px;
  margin-bottom: 22px;
  padding-top: 20px;
  padding-bottom: 20px;
}

.card + .card{
  margin-top: 50px;
}

.title-row{
  display:flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

h1{
  margin: 0;
  font-size: 25px;
  color:#0260ad;
}

.muted{ color: var(--muted); }
.section-title{
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--muted);
  font-weight: 700;
}

.back{
  text-decoration:none;
  border:1px solid var(--border);
  padding: 8px 10px;
  border-radius: 999px;
  color: var(--text);
  background: #fff;
}

.back-primary{
  border-color: rgba(37,99,235,.35);
  background: rgba(37,99,235,.10);
  color: #1d4ed8;
  font-weight: 800;
}
.back-primary:hover{
  background: rgba(37,99,235,.16);
}

.toolbar{
  display:flex;
  align-items: flex-end;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.label{
  display:flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

select, input[type="number"], .search{
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  background: #fff;
  min-width: 140px;
}

.search{
  width: 100%;
  min-width: unset;
}

.btn{
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

.btn.primary{
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}
.btn.primary:hover{ background: var(--primary2); }
.btn:hover{ filter: brightness(.98); }

.btn.danger{
  border-color: var(--danger);
  background: var(--danger);
  color:#fff;
}

.stats-pill{
  margin-left: auto;
  display:flex;
  gap: 14px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  flex-wrap: wrap;
}

.stats-pill .stat{
  display:flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  white-space: nowrap;
}

.stats-pill .ico{
  font-size: 16px;
  line-height: 1;
}

.stats-pill .lbl{
  color: var(--muted);
  font-weight: 700;
}

.stats-pill b{
  font-size: 16px;
  line-height: 1;
}

.focus .qtitle{
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 800; 
}

.qbox{
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.options{
  display:flex;
  flex-direction: column;
  gap: 10px;
}

.option{
  display:flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
}

.option input{ margin-top: 3px; }
.option b{ font-weight: 700; }
.option div{ font-weight: 400; }
.option div *{ font-weight: inherit; }

.option.correct{
  border-color: rgba(34,197,94,.45);
  background:#b0d6b9;
}

.option.incorrect{
  border-color: rgba(239,68,68,.45);
  background: #deb1b1;
}

.actions{
  display:flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.result{
  margin-left: auto;
  font-weight: 700;
  color: var(--muted);
}

.list{
  display:flex;
  flex-direction: column;
  gap: 10px;
}

.item{
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
}

.item:hover{
  background: rgba(37,99,235,.04);
  border-color: rgba(37,99,235,.25);
}

.item .row-top{
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: nowrap;
}

.item .q-left{
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item .q-left b{
  font-weight: 800;      
  white-space: nowrap;
}

.item .q-right{
  flex: 0 0 auto;
  white-space: nowrap;
  font-weight: 700;
  color: #64748b;
  font-size: 13px;
}

.item .row-bottom{
  margin-top: 6px;
  white-space: nowrap;
}

.item .correcta-line{
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 16px;
  font-weight: 400;      
  color: #0f172a;
}

/* =========================
   MEDIA QUERIES (Layout corregido con flexbox)
   ========================= */

@media (min-width: 721px){
  .toolbar {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
    padding-top: 6px;
    gap: 14px;
  }

  .stats-pill {
    margin-left: auto !important;
    width: max-content;
  }

  .header-actions {
    position: static !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    display: flex !important;
    justify-content: flex-end;
  }
}

@media (max-width: 720px){
  .toolbar{
    display:flex !important;
    gap: 10px;
  }
  .header-actions{
    position: static;
    margin-top: 10px;
    justify-content: flex-end;
    margin-bottom: 0;
  }
}